Send and monitor emails via SES.
2.7K
SES is an incredibly affordable way to build an email heavy application.
However monitoring the emails is a bit of a nightmare, and often requires custom infrastructure. Even setting up the SES -> SNS -> SQS pipeline is a headache for developers unfamiliar with AWS. And when that is done your still left with hooking in or building custom some dashboard for viewing bounces and all the vital information you care about.
00 provides an SST configuration step to set up the SES -> SNS -> SQS pipeline, so you can just run a command and let SST do the rest.
If you would also like to deploy the container with SST follow this guideā .
Then 00 provides you that dashboard for viewing the information you care about.

Some key features include:
POST request to /api/emails.If you like video walkthroughs Web Dev Codyā made a fantastic one.
The quickest way to get started is to clone this repo and run sst deploy in it. Make sure to set the EMAIL_IDENTITY env variable first, this will be the email or domain you wish to send from.
Using SST is easy, and you can find the steps to do so hereā and learn how to configure your credentials hereā
If you would like to avoid using SST you must manually configure AWS. You need to set up a configuration set to write to an SQS queue via SNS. You can configure it however you want, but the more events you send to the queue the more 00 will be able to track (obviously).
If you know what you are doing and you want to configiure AWS manually, you can follow this guideā .
Either option will give you an SQS url which we need, along with several other environment variables.
Currently SST does NOT deploy the container for you. It just sets up the needed SES pipeline.
In the near future you will pass a variable to SST to tell it wether it should host the container for you.
We publish a docker image to the registeryā
Simply run docker pull liltechnomancer/double-zero
Then run your docker container with the following environment variables set. Exposing port 4000.
Example docker run -it --env-file .env -p 4000:4000 "liltechnomancer/double-zero"
AWS_SECRET_ACCESS_KEY=
AWS_ACCESS_KEY_ID=
AWS_REGION= # Ex: us-east-1
SQS_URL= # Ex: https://sqs.us-east-1.amazonaws.com/${id}
SYSTEM_EMAIL= # For sending stuff like password resets. Ex: [email protected] should be able to send from SES.
SECRET_KEY_BASE= # A long secret. at least 64 characters. Can be made with mix phx.gen.secret or however you generate safe keys.
DATABASE_PATH= # Path to SQLite database Ex: 00.db
PHX_HOST= # URL or IP of where this service is running. Ex: example.com
Now visit your url (whatever you set PHX_HOST to) and register your user.
After you have configured SES, with sst or manually, you have to verify that you own your domain.
After you published these DNS records to you domain it can take up to 72h to verify your domain according to AWS. But realisticly it will be verified in less than 12h.
You can now make requests to your double-zero instance.
To send an email you have to hit the endpoint on yourdomain.com/api/emails.
Use you favorite libary in your preferred language that can do https requests.
Authorization Header to Bearer yourapikeyherePOST request to the endpointThe response of an successful request looks like this.
{
"data": {
"id": "51c2df38-0e3d-458b-9aff-3bf872868695", //This id is unique for every request
"message": "Your email has successfully been queued.",
"success": true
}
}
The request body has to be json with these parameters
| Param | Type | Required | Notes | Example |
|---|---|---|---|---|
| markdown | string | no | For the email body. Either markdown or html can be used. | {"markdown":"Some Text"} |
| html | string | no | For the email body. Either markdown or html can be used. | {"html":"<h1>Some HTML</h1>"} |
| subject | string | no | The email`s subject field | {"subject":"Some Subject"} |
| from | string | yes | The email address from which the email is sent. Must be [email protected]ā . The the domain has to be added to SES and be verified. | {"from":"[email protected]"} |
| to | string/string[] | yes | The emails recipient(s) | {"to":"[email protected]"} or {"to": ["[email protected]", "[email protected]"]} |
| cc | string | no | "The email address to which a copy of the email will be sent.". | {"cc":"[email protected]"} |
| reply_to | string | no | The email address from which the reply will be sent. | {"reply_to":"[email protected]"} |
| headers | object | no | An object containing key/value pairs of headers | {"headers": {"X-Entity-Ref-ID": "00"}} |
| provider_options | object | no | An object containing key/value pairs of provider options | {"provider_options": {"tags": [{"name": "tag-name", "value": "some-value"}]}} |
| attachments | array | no | An array containing attachments | {"attachments": [{"filename": "invoice.txt", "content": "pewp", "content_type": "text/plain"}]} |
{
"html": "<h1>Hello world!</h1>",
"subject": "Can your email service track multiple recipients?",
"from": "[email protected]",
"to": ["[email protected]", "[email protected]"]
}
Stuck? Tell me about it on Discordā and lets unstick you!
If you are eager to support this project you can pre-order a pro versionā for you to self host.
Planned pro features include
Content type
Image
Digest
sha256:861363773ā¦
Size
95.7 MB
Last updated
almost 2 years ago
docker pull liltechnomancer/double-zero