After signing up for CloudFlare to host my website, I found that it will automatically disable Google’s free email address that comes with the domain. I used the following steps to resolve this:
Signup for a free account on mailgun.com
Log into your account in Mailgun and add a domain from the top menu bar. Once your domain is added, you will see that Mailgun gives you a few MX records and TXT records to be added for your domain, for both successful email forwarding and verification of the domain.
Now go to CloudFlare’s DNS panel and add those MX records and TXT records provided by Mailgun.
a. Choose your site and select DNS Settings
b. Add the CNAME record. Name = email, Value = mailgun.org, TTL = Automatic, Make sure the cloudflare cloud is gray and not orange/active – You have to click on the cloud icon.
c. Add the two MX records
Name = domain.com (no www), value = mxa.mailgun.org, Priority = 10
Name = domain.com (no www), value = mxb.mailgun.org Priority = 10
d. Add the two TXT records
Name= domain.com (no www), value = v=spf1…
Name = smtp._domainkey, value = k=rsa;…
- Log into your Mailgun account and go to Routes section from the top menu. Now add as many routes as you want.
a. For example, if your domain is example.com and you want all the mails sent to firstname.lastname@example.org to be forwarded to email@example.com then create that route. So for me that means:
Expression Type = Match Recipient
Recipient = firstname.lastname@example.org
Actions = Forward to email@example.com
Priority = 10
Description = Forwards from my domain to my Gmail.
- If you want people to email TO you at that email, you are done – congrats. I wanted to go one step further and send email FROM that email address. To do this, I went into my Gmail and:
a. Log in to Gmail and go to settings – Accounts and Import:
name = Anything you want
email address: firstname.lastname@example.org (this should be the email you set up in the steps before)
# Leave treat as an alias checked
# Click Next Step
For the following info you’ll need to login to mailgun and use the info under Domain Information
SMTP Server Use SMTP Hostname from Mailgun
Username Use Default SMTP Login from Mailgun
Password Use Default Password from Mailgun
NOTE: I couldn’t get this to work, so I created a new SMTP user and password. I plugged this into Google. So it was:
SMTP Server: smtp.mailgun.org PORT=587
# Secured connection using TLS (recommended) radio button selected
b. Now comes the hard part, Gmail will send an email to that address and you will have to open to go to the link for verification:
#Thankfully, Mailgun is aware of people needing temp access to their mailboxes, so they created an event API that works like this:
c. You login to Mailgun and go to Logs for your domain and select the most recent inbox message.
d. You can see the API URL to the message along with its unique key under the “storage” section when expanding the log entry.
e. To view the message in the browser just copy the URL and enter “api” as username and your API key in the password box. This will let you to view the parsed message. NOTE: You get your API key under Account Settings in the web GUI.
f. Copy and paste the Google verification link in another tab to “authorize” your email as a trusted sender. Done!
- Now you can send and receive from a mailbox that seems to be connected to your domain!