Forward your email with Amazon SES

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, info@hyeeun-acupuncture.co.uk.

SES is not supported on London Region, I chose Ireland, EU-WEST-1.

Create a rule.

  1. Add recipient. info@hyeeun-acupuncture.co.uk
  2. In Actions, first choose S3 and select the bucket you want to store the email
    1. I’ve created directory inside the bucket, “emails”. Put emails as Object key prefix
  3. 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”?

  1. Verify your domain: O
  2. Configure in Route 53: O
  3. Set S3 bucket name: O
  4. 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.”

Lambda …

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

  1. Create a lambda with ses-forwarder.
  2. Verify domain on SES. Create MX record on Route 53
  3. Verify your email address on SES
  4. Create a rule set that SES receives emails to your domain. The rule set will have actions, 1) S3 and 2) Lambda
  5. Test

Resources

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s