Update Feb 2020
I’m sorry to announce that Mailgun have recently removed free access to Routes for new members and have completely redesigned their interface. There is no longer a free way to forward email through your domain to Gmail using Mailgun. This means the article below is now completely redundant.
I will do some research to find another free solution and update this article accordingly. So far, people in the comments below are recommending forwardemail.net as a possible free alternative. Though as I haven’t tested it yet, I cannot vouch for its reliability.
An updated article with some free and cheap solution is forthcoming!
In the meantime, if you know of any free solutions, please let me know in the comments.
Free, but with Limits
Mailgun has an allowance of 10,000 free emails per month (that’s around 330 emails per day), which is more than enough for personal email or a small website. Gmail has a similar limit of “500 recipients per day” – if you send any more than that, your Gmail account will be blocked for 24 hours.
If you intend on sending more than 330 email per day, this guide is perhaps not for you, and you probably won’t find any email service that would allow such volume for free.
1. Sign Up for Mailgun
Sign up for Mailgun here. You will need a valid credit card in order to sign up, but you will not be charged as long as you don’t go over the limit. This credit card requirement is to prevent spammers from signing up for multiple accounts.
When signing up, select Concept – Pay As You Go.
You will receive an email with instructions on how to verify your account.
2. Add Domain and DNS Records
Let’s begin by adding the domain. In this guide, I am setting up the domain for this very blog DevAnswers.co.
Note that the screengrabs in this article may look different if Mailgun updates or re-designs their control panel, but the process should be similar.
When you sign up for Mailgun for the first time, you should be prompted to add a new domain as part of the sign up process.
Enter your domain name. Do not use a subdomain as recommended by Mailgun.
If you have already signed up for Mailgun, you can add a new domain by clicking Domains in the main menu and then Add New Domain.
You should now see the screen below. If not, you may need to scroll to the top of the page.
You will now need to add some DNS records to your domain in order to verify it. Follow the instructions provided by Mailgun for your particular host.
In my case, I am using Cloudflare to manage DNS for this domain. Below I am adding five new DNS records.
Once you have configured your DNS records, return to Mailgun and click Get Started Sending.
Once clicked, you may need to scroll to the top of the page to see Domain Information.
It may take several hours for the new DNS records to propagate. Until then, you may see an Unverified state.
If your domain hasn’t been verified, scroll down the page to Domain Verification and DNS and periodically click Check DNS Records Now.
Once the domain has been verified, the states should all change to green.
Scroll to the top of the page to Domain Information and the state should be Active.
If you are still seeing an orange or red state, you will need to check back periodically and click Check DNS Records Now until the icons turn green. When they do, you can continue with this guide.
3. Create Route
Routes allow us to set up email forwarding rules. Here we will instruct Mailgun to forward emails from our domain to Gmail.
Click Routes in the top menu and click Create A Route.
In this example, I want to catch all emails sent to firstname.lastname@example.org and forward them to my personal Gmail account email@example.com.
Enter the following details into the Create New Route page:
- Expression Type: Match Recipient
- Recipient: Enter your domain’s email you want to match, in this example firstname.lastname@example.org
- Actions: Check Forward and enter the Gmail address that you want to forward email to.
- Store and Notify: Leave unchecked.
- Stop: Leave unchecked.
- Priority: 0
- Description: Enter anything here to describe the route, in this example “email@example.com forward”
Click Create Route.
Your new forwarding route to Gmail should now be ready.
4. Add SMTP Credentials
Click Domains in the top navigation and choose your domain from the list.
Under Domain Information, click Manage SMTP credentials.
Click New SMTP Credentials and enter the login username and password. (Generate a password)
In this example, I want to forward email from firstname.lastname@example.org, so I’ve entered info as the login for consistency.
Click Create Credential.
Above we can see our new credential. We can now use this in Gmail to connect over SMTP.
5. Set up Gmail
Log in to Gmail and go to Settings > Accounts and Import and click Add another email address.
Enter your name and email address, and check Treat as an alias, then click Next Step.
- Enter smtp.mailgun.org as SMTP Server. Port is 587.
- Enter the username (email address) and password your created in Mailgun earlier.
- Toggle Secured connection using TLS.
Click Add Account
You should now receive an email from Google with a verification number. Enter it here and click Verify.
Your account should now appear in the Account and Import tab in Gmail.
If you want Gmail to always send email through Mailgun by default, click Make default beside the account.
Also select Reply from the same address the message was sent to if you want Gmail to automatically reply through the correct account.
When composing a new message in Gmail, you should see your new account in the From field.
You’re all done! If you have any other domains, you can also add them to your Gmail account by repeating the steps in this guide.
p.s. I increased my AdSense revenue by 200% using AI 🤖. Read my Ezoic review to find out how.