Sending Email from a Forwarded Gmail Using Mailgun

This post is pretty much a sticky note for myself to remember how I did this, but someone out there may find it useful. The scenario is I forward my [email protected] email (hosted through Google Apps) to my [email protected] address. Two years ago now (crazy how fast that went), I configured Gmail to let me respond to those forwarded emails with the proper address, namely when responding to a Reclaim email, I want to use [email protected] rather than [email protected]. I wrote up the process, and its been working fairly well since. The one change I made since writing the guide, is that since my Reclaim Hosting email was run through Google, I had to use a transactional email service* (in my case SparkPost) to send emails through a different SMTP host. 

Anyway, recently my colleagues at Reclaim start telling me my forwarded emails were sometimes delayed 2-3 hours or more, which can be very problematic when you have an issue to address that is timely. Tim noted it looked like SparkPost was holding the emails, and recommended trying Mailgun to see if that is any better. So, I limped through the week, but finally sat down this evening and when about switching from SparkPost to Mailgun, what follows are the boring details with some screenshots so I can refer back to this post when I have to do this all over again 🙂

First step is adding your domain for your email in Mailgun

The first step, and this kinda tripped me up, is adding the domain for the email you want to send over. I was sending (at least in this example) using [email protected], but the domain I created was, even though I will not be sending email from [email protected]. Anyway, it is really a naming convention and a clean domain with to set you various TXT, MX, and CNAME records. So, that was the next step:

Once you create your domain you are directed to go to where you manage DNS and add a number of records.  We manage our DNS through AWS’s Route53, so I headed there and started adding records (there are two TXT records, two MX records, and one CNAME in all):

They will look something like the following (although your mileage may vary given this is the interface for Amazon’s Route53):

Once you have added all the records, you head back to Mailgun and verify they are working, which I did and they worked like a champ.

At this point I have Mailgun setup to send my email through their SMTP services, so now I have add [email protected] as an address I can use to send email from my main [email protected] account. 

You go to Settings in your primary Gmail account:

And then under the “Accounts and Imports” tab you “Add another email address” in the “Send mail as” section:

From there, you specify the email you want to send mail from:

And then add the Mailgun SMTP server configuration settings:

After that, you are all set.

I tested it out, and I now have both [email protected] and [email protected] forwarded to my primary Gmail account (not covered above) as well as the ability to respond to those messages from from my primary email with the appropriate email address (covered above):

And it seems so clear right now, but two years later when this all goes to hell I will have forgotten everything I thought I know, hence the blog!

*Transactional email services are services that provide SMTP API-driven email infrastructure for applications that need to provide notifications, updates, and subscriptions. For example, a common one with WordPress would be a new account notification or a reset password email, etc. Using API driven email services like SparkPost, Mailgun, etc. has become more popular when running applications through infrastructure that makes it easier to just have an email services send these for you.

This entry was posted in Documentation December and tagged , , , . Bookmark the permalink.

One Response to Sending Email from a Forwarded Gmail Using Mailgun

  1. Pingback: Reclaim Arcade: The Email Game | bavatuesdays

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.