No, that’s it. I am f#*&@-ing done. I went from gmail to tuta to proton. Now I hear something like FastMail. Some say privacy, some say security, but what they never say is corpos gonna corpo.
No, I am done using third party services. This may be a Sisyphus task, but I want to self host a mail server even if 60% of it goes to another person’s spam.
I’ve heard about Dovecot and some other services. While searching YouTube, I came across a defunct channel that still has this old video that gives instructions to selfhost email: https://www.youtube.com/watch?v=9zP7qooM4pY
Cherry on top would be to have as many parts with the GPLv3 license as possible.
Any guidance or instructions would be greatly appreciated. I have a domain name and I am currently hosting a small webpage for fun. Nothing serious.
I’m running stalwart for our church, and its been pretty solid for a while. Minimal maintenance required after correct deployment and DNS records. Of course, if anyone has a more user friendly option, with less or no 'enterprises features behind a paywall, I would love to know about those.
As someone who has been self hosting my email for years I have some advice: be wary, this is a difficult service to build well and if you dont then maintenance will be difficult, you risk exposing your data publicly, and your mail won’t be delivered. But if you stick with it you will find it to be incredibly rewarding and not really as much of a hassle as everyone thinks.
If you want something easy that will get you 90% of the way there and make the remaining 10% easy, I cannot recommend mailinabox or iredmail enough. I used MIAB for the first few years I hosted my own mail server, and it did well enough that I’d recommend it if you just wanna host your own mail. However I would recommend against these all in one solutions if you want to actually control, configure, and understand how your mail server works. I was given the same advice when I started and after a year and a half I was working on replacing MIAB with something I built myself.
Where I would recommend starting is the ISPmail guide1. This is one of the most comprehensive and well written guides for building a mail server. It does not cover everything, but it will get you a secure and reliable mail server with high deliverability if you keep your domain’s reputation clean. This means making sure your emails arent being blocked and that everything else is adequately secured so that no one blocks your domain; afaik I have only been blocked once when I was first starting out, and I haven’t had any issues since getting off that blocklist. The guide covers DKIM (which require DNSSEC as well), SPF, and DMARC. The guide does not include setting up MTA-STS, Fail2Ban, email auto configuration (i recommend automx2), nor webmail or DAV (i recommend Nextcloud), but none of these things are necessary for having good deliverability or a working mail server.
If you choose to continue, I wish you well and hope you have fun becoming one of the increasingly few self hsoted mail admins left!
Start here:
https://docker-mailserver.github.io/docker-mailserver/latest/
Also, you might buy this book for deeper understanding: https://mwl.io/static/books/run-your-own-mail-server.html
Check out mailinabox.email
It can be done! If it helps, I have made some comments on my setup and the discussions around those comments are very helpful.
I’d personally recommend using Stalwart. I managed to get this done at absolutely no extra cost, even behind double NAT.
I’ve been hosting my email for about 15 years now. And now it’s used by 7 people as their daily. And yes, there have been some issues. And yes, it’s complicated. But it’s also freeing and fun. If you really want to do it, go ahead and learn the ropes. I’ve never understood the people that say “OMG, you never want to selfhost that!”. I have a VPS, and you really don’t need a beefy VPS at all for a couple of accounts and some aliases.
VPS is a must (or co-location, but that’s more expensive). Check out VPS providers to see which are tolerant with email and how “clean” their IP reputation is. I have the Postfix+Dovecot stack, but I’m already eyeing Stalwart, because the LTS distro on my server is reaching it’s end-of-life, and if I have to go through the setup again (the switch from dovecot 2.3 to 2.4 is bumpy), I’d rather try something new. Btw, I don’t have an IT background, just been tinkering for a long time.
So buckle up and start planing.
Fuck yeah! Right first things first are you prepared to learn new stuff and know how to read documentation?
If you have never hosted email before I want you to go away and look at these topics before even starting. It will help you understand what’s going on Postfix, dovecot, SMTP, DNS records, SPF,DKIM, dmarc, fail2ban, what an open relay is, let’s encrypt, how to use lets encrypt for mail servers, email blacklists.
Once you get started setting up a server mxtoolbox.com is going to be your new friend.
Although I’ve never used it there is a mail server in a box https://github.com/mail-in-a-box/mailinabox which just installs and configures everything.
I’ve used Mailcow for years, after a couple decades of bespoke systems I built from scratch. I’m a real fan of the ease of it’s docker containers and update process. It beats maintaining your own stack and I haven’t run into any drawbacks. It’s pretty much what I had before but I don’t have to fit the pieces together whenever there’s a patch on one part.
Up until recently, I never had a problem sending messages but have had to set up a connector to SMTP2GO for Microsoft domains like live.com/hotmail.com since they’ve suddenly decided, after 25 years of no problems, that they don’t want my server to connect. The connector setup for just those domains was very straightforward.
The key thing is to make sure you have a healthy DKIM/SPF/DMARC dns setup. Most mailservers won’t care about PTR or they’ll just send a warning in your DMARC reports.
If you are on a resi IP, it’s highly likely you’ll have to relay all outbound traffic. If you don’t have high volume, SMTP2Go works fine under the free plan.
90% of the responses you’ll see on this is that you don’t want to host it yourself, probably by a bunch of people that woulnd’t even think to try. Ignore them if you’re determined to do it, it’s entirely possible if you’re willing to learn.
+1 for mailcow. I pay a small amount per month for an l2tp connection with a non residential IP which helps a lot.
I wouldn’t recommend it
If anything you could setup a local email server on your local network only
This is one of those things that everyone wishes they could self host until they try to, and then they regret it and desperately need to switch back.
Been there twice. Standing up a stack these days not too difficult. Getting your email accepted by all servers is a full time job.
Nah, if you dont care about 100% reliable delivery to Gmail/Outlook it’s ok.
As someone who used to manage a mail server, I would not do it ever again. Well, Installing and configuring them IS the fun part. Managing them, making sure the domain is not blacklisted, checking spamhaus, getting asked why I don’t reply their email while it was google who dump the email to the spam folder was not fun.
AWS Lightsail VPS, install Virtualmin. It’ll configure dovecot and postfix for you. You can use roundcube webmail (they have an installer) or Thunderbird right out the box. Setup DKIM, SPF, and DMARC. Request your PTR/rDNS from AWS and you shouldn’t get issues. I’ve run this for years and never had an issue with mail being blocked which wasn’t my own server blocking others.
Have you seen any issues from Microsoft recently? I can send to hosted domains, but the default ones like live.com and hotmail suddenly stopped taking my mail a couple weeks ago, after years of no issues. I did do a request to clear it, and escalated to a supposed person, who said it all looks fine but they weren’t going to whitelist me because <no reason>.
It happens every now and then. Support personnel claims that they are not blocking your address/IP even after you send them the message Microsoft servers send where it clearly states that your IP is blocked. Then you wrestle with the support for few emails, the problem magically goes away (which M$ support claims was never there) and then it comes back after few months or even few years.
They (as a company) are just being assholes, there’s no technical reason nor explanation. And that’s one of the reasons more and more people should self-host and complain loudly every time they’re blocked without any particular reason.
This may be a very nice proposition, but I, personally, would never give admin rights to a rando from the internet on what is to become my mailbox soon after…
I think you misread.
No you don’t.
Mail, even personal mail, is one of the most important services we have, and it’s probably the biggest pain in the ass to properly configure and make it trustworthy enough to go through everyone’s spam filters.
Not to mention keeping even two-9s uptime.
Check out mxroute, search the usual places for Black Friday coupons, you’ll find a great deal and can bring your own domain, and have imap and webmail ready to go.
It’s run by a dude who knows what he’s doing and is very transparent (if not, sometimes, a little too direct…you may see that in some of his posts/responses on reddit. He has zero tolerance for bots/spammers using his IPs)…
And if you are concerned about privacy, there’s no reason you can’t layer GPG on top.
Absolutely go ahead!
My recommendation would be to do so on a VPS, don’t do it with your home IP address.
Today there are some all in one solutions, but I prefer the old hands on at all levels approach.
This is my personal experience: https://wiki.gardiol.org/4-e-mail-hosting (no ads, no monetization, no AI).
I installed and setup postfix and dovecot and dkim dmark, the works.
One more advice: DNS records are key, do not skip them, everything depend on proper DNS setup in the email world.
Email self-hosting doesn’t have to be difficult. Ignore the detractors here.
I want to throw another option into the mix: nixos-mailserver. It sets up and manages a classic stack of email services. Through the magic of nix, you get a VERY reliable setup, and all the difficult parts (and those you don’t care about) are abstracted away in a really nice manner.
If you either already know nix, or are OK with investing a bit of time into learning the ecosystem, I urge you to go this route.
I’m running it on a Hetzner server. Had to ask them to open port 25, which was no issue. Set the DNS records as in the linked docs, and immediately had a 10/10 on mail-tester.com and no issues found on mxtoolbox.com
It’s also super easy to add additional domains. I’m hosting for multiple people now. Literally zero issues.
Again, don’t listen to the fearmongers. You got this.
It’s not the software that’s the issue. The issue is other sites not recognizing your server as legitimate, or your server being hacked and used to spam and putting you on a spam blacklist.
I had to give up independent hosting because of that.
Again, all records are correct and I have a perfect score on spam benchmarks. That’s at least partly a result of the configuration.
Getting hacked is a risk, sure, but with a common sense approach you can mitigate the risk pretty well. It’s also not unique to email hosting.
Sorry to hear you had a bad experience with it though.
Wait until the major providers randomly black list you for no apparent reason
How many years should I wait for that?
The problem is that google treat all small domains as spam.
People say this but I haven’t found it to be true at all. Are you just repeating the folklore of the self hosting community or are you speaking from experience?
I land in inboxes on google accounts without issue.
t-online was a problem initially, because they refuse mail from unknown domains, but it only took an email to get whitelisted. Apart from that, zero issues.
I did the exact same setup you described, hetzner, nixos mailer, all the dns setup was perfect, ipv4 and 6, perfect scores. Every single message landed in spam. I followed all google and Microsoft guidance and submitted to their whitelist forms, made no difference. I can only think i got a recycled ip that was blacklisted already. I use mailbox.org now
Dang. Yeah, recycled IP with a bad rep is unfortunately a real risk :/ Had you tried requesting a different one to see if it made a difference?











