How do I set up email for my Ubuntu webserver?

April 24, 2025 5 answers
Asked by film grain fan
I'm running a webserver on Ubuntu via DigitalOcean, and I've set up my domain (blabla.bla) to access it. Now, I want to enable email for the address [email protected]. I'm wondering about the best way to go about this. Should I consider setting up my own mail server, perhaps using a docker mail server? Or would it be smarter to use a mail service like Mailgun? Also, are there any providers that allow registration with a gmail.com address? Any tutorials for this would be appreciated!

Answers

12m rope length
Setting up your own mail server can be very complicated, especially with issues around spam. Even if you configure SPF, DKIM, and DMARC, a poorly reputed server can get your emails sent to spam or even blocked. Always check your IP's reputation first. Also, be aware that some providers like DigitalOcean block port 25 by default.
Reply to this answer
seam_ripper
If you're not an expert, I wouldn't recommend running your own mail server. I've been using mxroute.com, and it works really well for sending and receiving mail. Just make sure you set up your SPF, DKIM, and DMARC records correctly though!

utm32n: That sounds good, but can you share how much it costs? I really only need it for a few emails a month, like password resets. Also, do you have docs for setting it up on Ubuntu?

Reply to this answer
utf8_text
Receiving emails is straightforward, but sending them and ensuring they land in inboxes can be quite challenging. Honestly, if you're just starting out, it's best to use a mail service provider. Running your own server really only makes sense for larger operations with dedicated staff.

film grain fan: Thanks for clarifying! I've used Mailgun before to send emails and did a setup for forwarding to Gmail. I was hoping to find a new solution that works well.

Reply to this answer
vapor-pressure
Delegating your domain to a mail provider is usually the quickest solution. It might come with a fee, but it's often worth it. If you want to tackle the challenge of self-hosting, Iโ€™ve heard good things about mailcow.email, but I haven't tried it myself. Just a heads up: self-hosting can be a real pain these days!

point of order: Isn't mailcow a full-stack mail server? If it's that tough, would you still recommend it?

Reply to this answer
antique thimbles
If you want a simple self-hosted solution, check out docker-mailserver. It's pretty straightforward to set up!

93 percent certain: Iโ€™ve seen that suggestion, but many say itโ€™s risky because self-hosted can get you blacklisted. Is it worth it?

Reply to this answer

Add your answer

Answers are reviewed before publication.

Related Discussions