My partner works as acupuncturist. As self-employed person, she’s got a website, and recently, the hosting company was bought out, leaving her website down. I’ve moved her website to Amazon S3. Everything worked well, except her contact email address, firstname.lastname@example.org.
SES is not supported on London Region, I chose Ireland, EU-WEST-1.
Create a rule.
- Add recipient. email@example.com
- In Actions, first choose S3 and select the bucket you want to store the email
- I’ve created directory inside the bucket, “emails”. Put emails as Object key prefix
- In the next page, I’ve put info-rule as rule name. Then clicked on “Create Rule”.
I got an error, “Could not write to bucket: xxxx-xxxx-email” It’s because I didn’t set the policy in S3 bucket to allow SES access. I followed a very helpful instruction from https://docs.aws.amazon.com/ses/latest/DeveloperGuide/receiving-email-permissions.html. You need to know your account Id
Now, let’s send an email to test if the mail goes into the S3 bucket.
5 minutes later, the email still didn’t appear. What did I do wrong? I’m reading SES instruction again.
Interestingly, 10 minutes later, I’ve got an email from Amazon, saying “Please note that the rule that you configured to deliver emails to this S3 bucket is only valid if the entire setup process is successful. …” Hmm, what does it mean by “entire setup process”?
- Verify your domain: O
- Configure in Route 53: O
- Set S3 bucket name: O
- Set Object Key Prefix: X.
Ah I’ve missed setting the folder name as Object Key Prefix. I was setting it and writing about it at the same time. Also my colleagues were chatting loudly behind me, so I must have been distracted.
After a few more failed retries, I finally set it up successfully. The cause for the failure was that I didn’t put the name on Route 53 record set correctly. The name should be the same as the domain. In my case, the name should have been “hyeeun-acupuncture.co.uk.” Before it was “info-hyeeun-acupuncture.co.uk.”
I’ve created a lambda function, but failed to set it on SES rule set. It seems SES doesn’t have enough permission to access the function.
After while … It turned out that I had SES on eu-west-1 and my lambda was on eu-west-2. SES rule set wasn’t able to show the lambda function. So I’ve created a function eu-west-1. It enabled me to select the function on rule set and AWS console kindly added the right permission to the lambda.
It all works now. To summarise the steps I went through
- Create a lambda with ses-forwarder.
- Verify domain on SES. Create MX record on Route 53
- Verify your email address on SES
- Create a rule set that SES receives emails to your domain. The rule set will have actions, 1) S3 and 2) Lambda
- SES overview: https://docs.aws.amazon.com/ses/latest/DeveloperGuide/getting-started.html
- SES Email Receiving: https://docs.aws.amazon.com/ses/latest/DeveloperGuide/receiving-email-setting-up.html