-
Sign-up to Sendgrid and Mailgun.
- Get Sendgrid API key
- Get Mailgun sender domain
- Get Mailgun API key
-
Ensure AWS CLI is installed and configured to your account.
-
Install Serverless
npm install -g serverless
-
Update serverless.yml with your credentials from step 1.
-
Run
serverless deploy
-
Enjoy!
To send an email, make a POST request to the endpoint that you've deployed with a JSON payload.
-
Example endpoint
https://<random>.execute-api.us-west-2.amazonaws.com/dev/mailer/send
-
Email object model
{ "to": [{ "name": "<string>", "email": "<email>" }], "cc": [{ "name": "<string>", "email": "<email>" }], "bcc": [{ "name": "<string>", "email": "<email>" }], "from": { "name": "<string>", "email": "<email>" }, "subject": "<string>", "body": "<string>" }
- Audit logging
- Allows tracing and auditing of when a mail is sent
- Tests for connectors
- Integration tests
- DKIM Signing
- Spam score reduction
- Traffic shaping
- May want to load balance instead of just falling back
- May want to split traffic by recipient domain for better delivery rate
- Queue interface
- Backoff retries for free
- Discard time sensitive mail that are marked with a flag