DigitalOcean ❤ Mailgun

Forward email to Gmail with Mailgun

Here’s how to forward received email for custom domain to Gmail so we can manage it at one place.

In my case, I did point name server from NameCheap to DigitalOcean so all step will happen at DigitalOcean (would be easier at NameCheap BTW) so please make sure that you already setup DNS properly before begin.

At first I think I need to setup some kind of email server via Nginx but Lucky me! Mailgun offer services that do just what I need.

Mailgun services

But as usual it’s always plenty of trap out there along the way. So I’ll write it here in case I forget and just in case someone get stuck like me.


So we can send/receive email as custom domain name via Mailgun. To accomplish this, You’ve two sides to setup here.

DigitalOcean side

Go to DigitalOcean and follow Mailgun step to the end and just make sure it look like picture below for “mg” subdomain as Mailgun advices.


Or look like this in case you want to send email like “” instead of “”

just domain
Hint : Watch Out for “” (double qoute) at TXT value, and . (dot), and this trap

Mailgun side

Goto Mailgun -> Domain ->Domain Verification & DNS

Mailgun’s Domain Verification & DNS
Hint : It take around 5–10 min. to take effect.

Forward received email from Mailgun to Gmail

catch all

How to send email from Gmail through Mailgun to receiver

At Gmail -> Settings -> Accounts and Import -> Send mail as: -> Add another email address you own

Add another email addreess

Goto Mailgun -> Domain -> Domain Information and copy & paste

Fill information you got from Mailgun page

Nothing fancy here. Keep going we almost done!

Add another custom domain email


Send email as custom domain

And now I can use Gmail to send (as and receive any email which sent to domain which super cheap from NameCheap!

Note (ref)

You can get free $10 for DigitalOcean (which is 2 months free hosting).
You can get cheapest .io and nice UI/UX at NameCheap.

Happy Mailing!