Categories amazonGoogleInformationTechTrend

How To Send Your Domain Name Email With GMail  – Part II (With Mailgun)

Remember we posted the part I couple of days ago and we promised that we would get back and provide information (or step by step tutorial) on how to hook your domain name email with GMail and Amazon SES? Well… we would like to put that on hold and take you onto another much easier and productive route instead. Why? Because Amazon SES overcomplicates the process of achieving our goal which is having a cost-effective (often free) SMTP server which can communicate with GMail and get our domain emails sent and received via GMail servers. Long story short, if you wanna use Amazon SES to get those jobs mentioned above done, you will need to have all the followings to start in order to get the jobs done,

1) Amazon ec2 account

2) IAM credentials and policies setup

3) Amazon Simple Email Service (ses)

4) Amazon S3 Bucket

5) Lambda function

That’s right. You need to have one account and initiate ses service and hook that service up with s3 bucket along with a Lambda function. Also… in the middle of the process, you need to create a SMTP server and grab the credentials of that and then set rules on the receiving email end … in addition to all of those, you will need create new policies on IAM to link those policies with Lambda function and SES services.

Get confused? Well… it is because it’s very confusing if you don’t have a step by step guide to do that you will most likely to fail on this task. We will still get back on this since we still would like to provide this knowledge to a niche group of people who need to use SES for specific reasons. Don’t get us wrong… Amazon SES is super powerful since it’s highly configurable. For instance, a lot of IoT (Internet of Things) startups might need to use it to embrace Alexa (Amazon smart home platform) functionalities. So … we will get into it later on.

Meet “MailGun” – A Great Solution to hook up Gmail with Your Domain Name Emails

If you would like to achieve most of the email functionalities that Amazon SES offers, “Mailgun” is a great and much much much easier solution for that. To be honest, most startups (companies/corporations/organizations) just wanna get sending and receiving jobs done without enduring too much pains. If you choose Amazon SES, you will be beaten almost to death before you can get things all set and ready to go. However, Mailgun provides a simple, clean, and easier route to get us to where we want to be (in terms of the email related stuff). Also, the user interface is much much prettier and friendly than SES. Well… to be fair, Amazon SES has a huge advantage on the cost side. If your organization is sending millions of emails per month, it’s better to go with Amazon since the cost will be significantly lower. However, it will ultimately depends on the situation that if you wanna maintain the overcomplicated setup on SES or you would like to pay $ for significantly reduced pain on the maintenance end.

Concept – Sending Your Domain Name Email With GMail With A 3rd Party SMTP Server

Before we begin, we would like to lay out the logics. After that, you will have a clearer idea how this is being implemented.

So first thing first, you need to have a SMTP server which we are going to use Mailgun here. After you set it up (later on this post), the sending and receiving logics are as follows,


Sending Emails Through GMail In your web app, or mobile app,

1) point mail settings to Gmail

2) in the Gmail  configure SMTP settings to your smtp server

3) send emails on your app first to Gmail but actually GMail is doing that through your smtp server. On the receiving end will show the "from address" your domain name email address you assigned. If you dig deeper, you will be able to see other information which shows that the emails was sent via GMail

Receiving Emails On Your SMTP Server

You need to be able to manage your Domain DNS

1) Set up MX record

2) when receiving email it will be forward to the mail server you point to via MX record. In this case, it's Mailgun server.


that’s because …

on your smtp server you set up a forward address to your Gmail


So … let’s begin…

How To Hook MailGun With Gmail and Your Domain Email – Step By Step Tutorial

Step 1:

Sign up with Mailgun if not already. You will be able to have up to 10,000 emails or messages receiving or sending via Mailgun for FREE.

Step 2:

Click “Domain” tab on the top navigation menu. Click “Add New Domain” Button to add new domain.

Step 3:

After you click add new domain, you will get “TXT”,MX“, and “CNAME” records information that Mailgun provides you for you to verify the domain (to make sure that you are the domain owner). You will need to go to your DNS provide to manage/edit your domain name DNS records. 

Step 4:

You will be able to check if the newly added DNS records has been effective (sometimes it will take up to 48 hours to propagate but in most cases, it will only take minutes) on the next page after you click the “Continue To Domain Overview” button.

Step 5:

Once it becomes effective, you can create your route (forwarding address to get emails received by Mailgun to your GMail). Click “Routes” on the top navigation menu.

Step 6:

Click “Create Route” button. Mailgun provides several ways to match your recipients but we are going to go for the most straightforward one. If you need other features, you can study their documents and implement accordingly.

a) Expresion type: Mactch Recipient

b) Recipient: Your domain name email

c) Forward: The GMail Address you would like to be hooked up with.

d) Priority: 1

Then … click “Create Route” button and you are done on the Mailgun end setup.

Step 7:

Sign into your GMail and click on the “Settings” icon on the top right corner beneath your account avatar. And then … click “Settings” on the dropdown menu.

Step 8:

Click “Accounts and Import“. On the “Send mail as:” section, click “Add another email address“. Input the email address you would like to GMail to send from and click “Next Step” button.

Step 9:

Input your domain SMTP credentials. You can find your domain SMTP credentials on Mailgun domain page. Choose your domain and you will be able to see the credentials on “Domain Information” section.

Step 10:

You will be asked to verify the ownership of the email address you would like GMail to manage. Just follow though the procedure that GMail takes you to. Then … it will be all set.


From this point going forward, you will be able to send and receive emails via GMail.

As we mentioned, you can even send your email by pointing the mail server settings to GMail SMTP settings in your app then … whenever your app trigger the send email function, you will be able to use your domain name email to send email to your recipients. Meaning the “From:” address will be your domain email address. Also, you will be able to manage all of you emails through GMail.

Super awesome & Cool, right? 🙂