Question

Moving email off of Gmail to Digital Ocean droplet.

With gmail forcing changes to the UI (the new god ugly one), I would like to move my email off of gmail and on to my Digital Ocean server. Does any one have any info one how to do this, with little to no pain. And what do you guys use for spam filters, etc.

Subscribe
Share

That’s reasonable. I guess you have to do it yourself then. Our friend jarland has linked to some good tutorials.

Good luck!

I looked over that, not sure I want to give my root password out to someone else.


Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hey friend!

This is a good question. This is a subject very dear to me, I love running email servers. First, let me tell you why you shouldn’t run a mail server. We put this together a few years ago and it still rings true:

https://www.digitalocean.com/community/tutorials/why-you-may-not-want-to-run-your-own-mail-server

Aside from that, I run mail servers for a lot of people, and I can tell you first hand that nothing in life has ever caused me more pain and suffering. Whether or not it would bring you the same depends on your needs. A lot of people just want to receive email, and very rarely send any out. Those users will be more easily pleased. I deal a lot in sending, and that is where the frustration lies. I’ll explain.

Unless you are yourself a large corporation with incredible power and influence, with your own IP address space, someone is going to block the emails you send. With Google and Outlook, for example, they have that power and influence, while specifically managing an email infrastructure on their IP space, and it protects you. With your own server, sharing IP space with other customers, neither us nor you can intervene in some of these blocks that occur. Your email will reach Gmail unless you send spam toward them (don’t forward email to their service, this causes blocks). Your email might reach Outlook (Hotmail/Live) and, if it doesn’t, they might unblock you if you fill out a request. Your email will probably never reach Verizon or AT&T, and they will not respond to requests to lift a block (from anyone, for any or no reason).

To add to that, there are things you have to specifically do to play by the right rules with email. If you don’t play by the rules, anyone you send mail to considers you a spammer. Your server’s hostname must be set (ex. mail.yourdomain.tld), the mail server must be configured to send that hostname as it’s HELO statement (ex. “Hi, I’m mail.yourdomain.tld”), and the A record for the hostname must point to the IP of that mail server (ex. mail.yourdomain.tld > 1.1.1.1). You should have an SPF record in your DNS like this, saying email from yourdomain.tld is allowed to be sent from the droplet IP (let’s use 1.1.1.1 as the example IP). It would look like this:

Record name: @ or blank Record type: TXT Record contents: “v=spf1 ip4:1.1.1.1 -all”

Many will recommend DKIM as well, and it has it’s benefits, but I’d recommend you get comfortable with everything else before you tackle DKIM. I’ve seen it trip up too many people, you don’t need that as an initial roadblock.

Now that I’ve told you the scary parts, let me talk about how to set up a mail server. This is the easy part. You may as well use a pre-built stack, just because it’s there and makes life easier. I’m fond of this one right now: https://mailcow.github.io/mailcow-dockerized-docs/install/

I’ve also had a lot of success running this stack in the past: https://docs.iredmail.org/install.iredmail.on.debian.ubuntu.html

If you want guidance on setting up your own from scratch, this tutorial is pretty in depth: https://www.exratione.com/2016/05/a-mailserver-on-ubuntu-16-04-postfix-dovecot-mysql/

Though I prefer rspamd to SpamAssassin myself, for filtering inbound and outbound spam.

Hope this helps :)

Jarland