I recently moved from a shared host to running my own machines on Digital Ocean. It's taken a lot of learning and research to figure out how to set things up for myself but one of the more recent hurdles was configuring my email addresses.
I have a handful of domains that don't have websites but do have email addresses. Almost all of these end up redirecting through to gmail accounts and are managed there.
I went looking for a solution for my email routing and ended up settling on Mailgun.
Mailgun handles sending, receiving and forwarding emails for you so you don't need to install anything on your server. Sounds like an excellent solution for Digital Ocean where I may end up adding/removing Droplets over time.
As part of the set-up process Mailgun needs you to:
- Add MX Records for receiving emails
- Add two TXT records
- Add an optional CNAME record for email tracking
For this next part I'm going to assume you've already got your domain name pointing to Digital Ocean's name servers.
Jumping in to the Digital Ocean admin area and heading to the DNS section you will see the nice big blue button at the top right to Add Record. Mashing that will get you a selection of records to add.
The MX records are easy. Just enter them exactly as provided from Mailgun but with a full stop at the end of the domain name and you'll be sweet.
The TXT records gave me a lot of trouble. I was entering the full name as provided by Mailgun like: krs._domainkey.dangeroustestlab.net and this was not working. Digital Ocean didn't throw any errors and if I went looking for the record using a dig lookup I got nothing. Something was not working.
The first thing you need to know is that the values need to be quoted. Don't quote them and they just won't work.
My values were still not working though and I didn't know why.
I posted in Digital Ocean's community support section and got the answer I needed from jesin:
Don't use the entire domain name, just enter k1._domainkey. Or you can place a period at the end of the subdomain.
Following these instructions I ended up with:
Which worked wonderfully! With these entries now in place Mailgun verified my domain name and I could set up routes to forward my email addresses on to their respective gmail accounts.
You can read more about setting up routes in Mailgun on their help files.