36

I am searching a way to redirect email which are sent to a domain whose DNS is Amazon's Route 53 service. E.g. I would like to redirect the email me@example.com to myname@gmail.com. And second@example.com to whatever@live.com. Is this possible to do with Amazon's Simple EMail Services (SES)? Is there another way to do with with AWS services (except setting up an email server on EC2)?

5 Answers 5

29

SES is not able to redirect messages by itself, but can call Lambda function and it can redirect message.

There is ready to use Lambda function: https://github.com/arithmetric/aws-lambda-ses-forwarder

4
  • 1
    That lambda function doesn't work for me. SES requires all sender addresses to be pre-verified and throws an exception. Feb 17, 2016 at 20:53
  • 1
    Is it also possible to point it to an SNS that has an email subscriber? May 17, 2017 at 17:45
  • 1
    Currently this lambda function adds a Reply-To header with the original sender and changes the the From header so it should also work for not verified sender addresses.
    – gonz
    May 31, 2017 at 15:18
  • 2
    @Scott Better explained in Limitations section in README.
    – Bobík
    Dec 19, 2017 at 13:59
16

I had this problem recently (July 2019), and googling it brought me here. The answer was not so obvious to me, so here is how I configured my domain on Route 53 to both receive and send email with my email account at gmail:

Receive email: Use improvMX to forward all emails directed at *@yourdomain.com to your personal mail. I have found this by looking at this answer. You only change your MX records on Route 53 and setup a free account on improvMX. improvMX will then forward all the email directed at your domain to your personal email. You can also select specific mail addresses for forwarding like hello@mydomain.com. This is way easier than you think. It took me literally 5 minutes.

Send email: Amazon SES service is basically a SMTP server for sending mails. So if your domain is on Route 53, then using Amazon SES is really easy. Here is the Amazon SES doc for sending mail using SMTP. Basic steps for connecting SES with gmail:

  1. Create an IAM user as explained in the AWS doc, which will give you a username and a password.
  2. In your gmail account add another email address to send as.
  3. Uncheck "Treat as an alias". (When checked, gmail will try to receive emails from SES, which won't work.)
  4. Use SES's SMTP server address for SMTP server, and IAM credentials obtained previously for username and password.
  5. You're done! Now you can send emails using myname@mydomain.com from gmail.

Additional note here: In order to send mail using SES you need to get your SES account out of sandbox.

I know the question only asked for receiving emails, but I figured someone might be looking to do both receiving and sending, like me, so I hope this answer helps someone.

5
  • How have you found this combo working now that some time has passed? Any issues (e.g. spam, bounced emails)? Oct 18, 2019 at 14:47
  • 1
    @shaneparsons It's still working without a problem. No issues so far.
    – obayram
    Oct 21, 2019 at 8:09
  • 1
    Keep in mind the improvMX free account is limited to 1 domain.
    – Dzhuneyt
    Nov 6, 2020 at 22:48
  • 1
    Why even bother with SES for SMTP when you can use Gmail's free SMTP server with your domain? Feb 16, 2021 at 10:12
  • ImprovMX now allows you to use way quicker SMTP server and hassle-free then AWS
    – Muhaddis
    Jun 8, 2022 at 21:14
10

This email redirection is the "missing feature" of the AWS platform, but there is a "free" workaround that will provide the redirection for you. Create an account with mailgun (free for under 10 000 emails a month) and when you set up your domain, you can redirect it to the mailgun servers (which is very clearly explained in their documentation). You can then use a combination of what they call "routes" to setup any combination of redirects based on:

  1. Email name being sent to john@foo.com or jane@foo.com
  2. Subject of the email
  3. Various properties of the email header

I was fully ready to give up on having email accounts under my Route 53 domain, but this worked perfectly for me.

6
  • 6
    Amazon announced that SES is able to receive emails. It is possible to redirect it?
    – shark
    Dec 13, 2015 at 16:16
  • 1
    I had a bit of a look at the email receipt rules and it just doesn't look like redirecting to another email address is supported out of the box. It sounds like you could write a Lambda rule that does this but I'm not going to bother as the way above works fine for the small percentage of stuff that comes through the catchall. Feb 8, 2017 at 15:45
  • 5
    Mailgun costs 35$ per month for inbound emails
    – jontro
    Jun 3, 2020 at 22:56
  • 5
    Mailgun has discontinued the free "routes" options, so now you are stuck with paying $35+ USD to use this unfortunately. It worked great until they made this change. Sep 18, 2020 at 0:31
  • In addition to forwarding to Lambda, SES can set/overwrite headers in the email. I wonder, if the TO header was modified then if the email would be forwarded elsewhere automatically (without needing to use Lambda to push the email back out via SES again or some SMTP server)
    – sudo soul
    Dec 1, 2020 at 5:58
1

AWS have documented how to do this using a lambda written in Python

https://aws.amazon.com/blogs/messaging-and-targeting/forward-incoming-email-to-an-external-destination/

2
  • This solution won't just forward the email untouched; it creates a new message, adds the old message as an attachment, and sends the email from an email address you've predefined. (I just tried it.)
    – k-den
    Feb 5, 2022 at 0:05
  • Had a lot of trouble getting the forward to work - gave up in the end so YMMV
    – fiat
    Feb 5, 2022 at 21:35
0
  1. add domain to aws SES & verify it
  2. add to DNS MX record so SES could receive emails for eu-west-1 region DNS record would be: 10 inbound-smtp.eu-west-1.amazonaws.com
  3. at SES service go to Email receiving and create rule set, inside rule set create rule. In rule set you can select SNS topic, create SNS topic & select it.
  4. go to Email receiving again and enable the rule set, make sure it's "active", rule inside rule set should be active by default.
  5. go to SNS and find your topic. Now question is where you want to sent the notification about new email from SES. In SNS create subscription.

Hint: Subscriptions in SNS must be confirmed or they will be inactive. Destination gets URL to click for confirmation.

Hint: Make sure to do all of these things on same region and use correct region for inbound url while creating MX record.

Hint: If using slack, you can get free email in channel settings & subscribe channel to SNS. You can forward message object to any destination what SNS support. Email, lambda, sqs, https etc.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.