There are two set-up steps for SES itself:
- Set your domain up with appropriate SPF/DKIM/DMARC records so Amazon & email recipients know everything is on the up-and-up
- Ask Amazon to take your AWS account out of the SES sandbox (aka email jail)
The first step is pretty standard: Sparkpost/Mailgun/Postmark/etc all require this as well. The second step is unique to Amazon – when I used Sparkpost, I never had to submit a ticket to get started emailing. In my experience, it takes Amazon ~24h to take you out of email jail.
One your AWS account is set up, you just have to set
MAIL_DRIVER=ses in your app environment through the Vapor CLI or console.
Caveat: SES isn’t everywhere
A big caveat is that SES is only available in a couple of regions. If you’re deployed to
us-east-1, everything is going to work fine.
I am not deployed to
us-east-1. Instead, I use
us-east-2, which is closest to 90% of my customers. There are no SES API endpoints in this region.
To work around this, you need to change the
services.ses.region config value in Laravel. This currently requires editing the config file: Vapor will inject
AWS_DEFAULT_REGION, and you don’t want to set that to
us-east-2 or everything else will break (DyanmoDB/SQS/etc) since those are in your default region.
I change it out for
'ses' => [ 'key' => env('AWS_ACCESS_KEY_ID'), 'secret' => env('AWS_SECRET_ACCESS_KEY'), 'region' => env('AWS_SES_REGION', 'us-east-1'), ],
Then in your Vapor environment config, you set the
AWS_SES_REGION=us-east-1. Redeploy and your emails will work!