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.
well I came here to tell you to not even bother trying after my last experiences with trying to get email delivered from my own server - but having read some of the comments in here, I may just be inspired enough to try again myself…
Thoughts and prayers, buddy.
Email is now a cartel.
First get a VPS and an IP address and validate the IP address is either not on black lists, or more likely, start the process of removing it from blacklists. You can find blacklist checkers, just search “SMTP Blacklist Checker”.
Then while that’s in progress you can start setting things up. I really found Mailcow to be the easiest and most robust since I wanted OIDC integration. It’s not the best integration and takes a little setup, but it works reliably these days to generate mailboxes and set passwords. You have to include the hashed passwords in your OIDC configuration to get the mailbox passwords set automatically. The web UI does integrate with the OIDC provider though. Mailcow comes with fail2ban and helps set up DKIM and other security settings on your DNS records for proper validation by the receiving SMTP servers and all of that. And has built in spam filtering and virus scanning, though I think virus scanning is not worth the resources it requires since it’s pretty easy to just never open attachments unless you were expecting them. Hopefully most of us know that. So, while it’s tedious, it’s not too difficult if you follow the instructions.
The only issue that I still keep gmail around for is that some companies, especially financial or healthcare companies, will refuse to send email to domains they haven’t white listed and mostly they only white list the big ones webmail sites like gmail or proton or outlook, etc. Not much you can do about that usually since they have a misguided belief that those domains are somehow more secure, even though they are actually selling your mail metadata and sometimes actual content or at least feeding it into AI models which can leak personal information “unintentionally”.
Overall, though, it’s well worth it since I can store as much as I want or at least it’s cheaper storage space than webmail providers. And I prefer the maildir storage over database storage in newer systems since it’s really easy to split and archive data to cheaper storage space. So mailcow works for my needs.
good luck.
i tried that many years ago and it is lot of work and it sucks. your important emails will get blocked on recipient servers for all kinds of reasons and their emails will end up in your spam folders… and that was before the gmail, outlook and yahoo (that host most of the addresses with which you might want to interact) went full mafia and started inventing all kinds of non-stamdard rules to block smaller providers out and changing them at random.
i admire your intention and optimism but hosting is hard.
I’ve been running my own email server since around 1996. I go old school with sendmail and dovecot on linux, but sendmail isn’t for beginners…postfix or exim are easier to configure with lots of add-ons available, and others have suggested several other MTAs that are probably just as good. Nowadays its more work to get started with sending emails (w/o getting rejected immediately as spam) since you’ll need to configure DMARC, DKIM, and SPF along with reverse DNS, but not that hard if you’re somewhat technical and willing to learn. The big providers get to set the rules here, and they’re incentivized to make it hard for a self-hoster, because that also makes it harder for spammers. The first few weeks your emails will get directed to spam folders until the providers learn your domain and associated IP address aren’t from a brand new fly-by-night spammer but it’ll taper off, you just gotta keep at it.
The biggest annoyance and work honestly is on the receiving side, with all the spam filtering work you’ll need to do once your email gets onto the spam lists. The big email providers have entire teams set up for this. You’ll also need to set up your own DNS resolver to use spamhaus and spamcop blacklists (which is what everyone uses because they’re so good), because all the public resolvers (and the shared resolvers at your VPS or cloud provider too) are already hitting them so much they get rate limited. Good news is once you get those blacklists configured correctly that’ll take care of probably 80% of the spam, then a standard open source package like spamassassin or spamprobe normallys gets most of the rest.
Another reality is that your home residential connection won’t let you send email from their network; this really reduced spam as people’s compromised machines can’t be used to send spam anymore. However, there are providers out there intended for home self-hosters that will route you a static IP that you can configure reverse DNS on and enable outbound port 25 connections. https://getrealip.net/ is one of them, see their guide for self-hosting email here: https://getrealip.net/guides/self-host-email-server/
Here is the issue with self hosting email. Residential ip’s are pretty much verboten from being able to receive email by the big companies. That means everything you send it will be automatically deleted. That’s if you can even set it up to work as most ISP’s block the needed ports. No a VPN won’t fix this or solve the problem. You can receive with no problem but to send you will need to use something like SMTP2go or if your ISP is capable (and willing) they can send.
If you want someone to blame look to the Spammers and Hackers of the world.
I’m in the process of moving everything I do to self hosted as much as possible. Email is a bigger nightmare than web hosting at home. The only other option I can find (for self hosting) is collocation of your server in a data center.
Seconded. I used to selfhost email, and it’s a pita. Doable, sure, but in my case I concluded that it just wasn’t worth it.
If you want someone to blame look to the Spammers and Hackers of the world.
But don’t forget the reason why all of this is necessary: email was created by hippies, and therefor any kind of security was really not on their minds when they built this stuff ;-)
Ah yes, the hippies at ARPANET
That was the network, but email itself is a very hippie thing.
https://en.wikipedia.org/wiki/Jon_Postel
I cite this article regarding his death: https://circleid.com/posts/in_memory_of_jon_postel
Jon loved the outdoors. I know he used to enjoy backpacking in the high Sierras around Yosemite. Bearded and sandaled, Jon was our resident hippie-patriarch at UCLA. He was a private person but fully capable of engaging photon torpedoes and going to battle stations in a good engineering argument. And he could be stubborn beyond all expectation. He could have outwaited the Sphinx in a staring contest, I think.
Edit: Here’s a picture of email’s hippie-in-chief:

Seems like he was a great guy, but security was not on his mind back then.
A bro named “Postel” helped develop Email standards. What a trip. :-D
Bro wrote like half the Internet rules
Very cool!
I am honestly very thankful I am in Canada, with a good ISP. My (non-static) IP hasn’t changed in 3 years, and there are no non-piracy restrictions on it at all. Self hosting email was as easy as following Maddy’s setup instructions in a lxc, and pointing Caddy at it. I did set up smtp2go for outgoing mail, just to reduce the chance of it hitting spam on the rare occasion I need to send a personal email, but have had 0 issues receiving.
For $3 a month, forwardemail will forward both inbound and outbound email for you. You’ll still have a lot of work setting up DNS entries and spam filtering, though.
BTW, I don’t know whether it was mentioned or not, but this book by Michael W Lucas, is a very good guide to whom want to accept the challenge of running their own mail server:
I’ve self-hosted email for over 25 years. Much has changed, but the basics are still the same - and it’s not difficult.
The first thing I would ask though is what are you looking to spend, before any required hardware? Meaning just the reoccurring provider fees, whether that’s your broadband ISP provider with static IP service added on (this almost always requires a business account, also very easy to do), or a cloud VPS provider (probably cheaper)?
Thank you! I don’t get why these threads are always so full of FUD.
Once I setup email it’s been little to no maintenance. Very “set it and forget it”. I check my logs after I see the software updated by my package manager to catch breaking changes. Which are super rare. I’ve had to increment a version number in a config a time or two.
My VPS’ SMTP config used to work and now doesn’t sure to spam prevention shit
There’s no FUD, just D.
Hundreds of us here on Lemmy have hosted our own email before, some (like me) for over a decade. We share our opinion that it’s on balance not worth it as (from experience) it’s a massive pain in the arse to keep yourself off blacklists. You do you though.
I had to do a thing with Google one time to validate my IP so that Gmail didn’t mark mail from my server as spam. I’ve never had to do any sort of blacklist removal process. I’ve been hosting email for my own domains since 2006.
What gets y’all on blacklists?
Seriously do you not get blocked at all? You never fail to get email you expected? How much of your time is spent petitioning off of blacklists?
I very rarely have to deal with blacklists for my email servers. But that’s when using a paid-for static IP address. Which is why I asked about budget. When you implement a proper DMARC framework with both DKIM and SPF you’ll have no problems with your emails reaching your recipients’ inboxes. Now, if you let other users send mail from your server you have to make sure they enforce good login security. That’s where you can get yourself on a blacklist.
Running an email server with a residential broadband service makes things more complicated and requires more frequent intervention.
For my IoT email servers, I have to attend to those a bit more with the black lists because even if you purchase static IP assignment with your commercial wireless service, those IP blocks are submitted by the carriers (Verizon, T-Mobile, etc.) to databases like Spamhaus to deliberately flag them as wireless static. With Verizon’s blocks, you have to remove yourself from the soft black list once a year. T-Mobile submits their IP blocks with an additional flag that prevents you from removing your IP from Spamhaus at all, so T-Mobile static IPs are not good if you need to direct send without user authentication.
I’m also selfhosting mail and I had to do some initial work to remove the server’s IP from blocklists. That was pretty much it.
Receiving email isn’t an issue. Other servers will just send them, I think they only check the blocklists if it’s the other way 'round. Gmail is a bit nasty, they’ll occasionally do weird things if I send out newsletters and mailing lists. But with all the other providers it’s mostly just fine. Issues arise once I (inadvertently) forward spam. That leads to some extra work.
I do have to tune my own spamfilter regularly. So there’s some effort I put in.
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 run my own email server. Of all the services, email is the most complicated and weird and fucked up. It’s hardcore doing it yourself. I’m glad I do, but make sure you have the time and energy to get it all going.
Do serious research first. Make sure you have time. Make sure you have a good VPS or commercial ISP. Don’t be half assed or it will fail.
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.
Well, kind of true. Email servers depend on the actual server you use, how it is configured, the DNS records and the routing. Those are the main 4 components that can make or break self-hosting email.
I self-host absolutely everything, and email was the last frontier for me, and it scared the shit out of me in ways you probably can’t imagine.
I’m not a developer, certainly not particularly smart, and make so many fucking mistakes on a daily basis that half of them is already too much.
So I decided to study the evolution of email all the way to today, what each part does, how much control I would actually have over each part if they break, and got to work. This is what landed me on deploying stalwart in a cheap VPS, but even though my VPS allows port 25, precisely because that is the part I have no control over, all SMTP is routed over SMTP2Go.
Do I already understand every single gear involved in detail? No. Am I prepared enough to tackle something that can go wrong? Absolutely, and I’m still learning.
It so happens that my fear came from reading all the horror stories from the people that tried, failed and gave up. Turns out that, while it is the single most involved service I have deployed in my self-hosting track, its absolutely doable. And the level of satisfaction I have with my effort after figuring it all out and finally getting it up and running has no words to describe it.
I decided on this because all the bullshit going on with Proton has convinced me that there are no tech companies left out there worth my trust, so I’m taking this for a long spin hoping to be able to migrate my whole family away from the proton family subscription the moment the 2 years I prepaid for end.
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.
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?
deleted by creator
Lol
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?
So what I did has worked great.
Life is way easier if you are running something like opnsense as your firewall. Then you have really good spam filtering available at the firewall through e.g. pfblocker.
I learned Exim. It’s super configurable and stable. I got a VPS and put another instance of pfsense on it with wireguard tunneling back home to my dynamic IP (which pfsense handles via dyndns). The static IP and VPS costs about $5 a month. Exim lives on the home machine and haproxy on the remote VPS handles email receipt and forwarding.
Only a few problems with the IP when new getting blocked by Google. I had my SPF/DKIM/Dmarc set up and requested unblocking and they did it in several days, and that was all.
The advantages here are that you can easily update without changing configs, the wg tunnel is stable, and your host remains on your own server, and pfsesne along with spamassassin and the native routing and session tools in Exim kill most spam.
Some investment up front can really pay off. Oh also you can use ACME on the pfsense instance to handle all your certificates through let’sencrypt automatically.
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.
What issues did you run into with Tuta?
Go for it. More people should. I’m running postfix+dovecot combo on a VPS running Debian.
As others have already mentioned, you’ll need a server with static public IP address and a way to change DNS PTR record for it, so in practice for majority of people that means a VPS from (preferably) a reputable vendor. Then you’ll need to set up DNS records for your domain, MX and SPF are sufficient. DKIM and DMARC are nice to have, but not strictly speaking needed, at least for now.
When configuring your SMTP service make sure that no one other than intended users can send mail trough it. That’s pretty much the most important thing if you want to stay out of blocklists. You’ll still end up in a few and it needs some manual work to resolve, but the longer you run your own server the fewer false positives there will be.
Some will suggest mailcow or some other ‘all in a box’ service. They very likely work and may even work better than good’ol postfix, but I’d still recommend postfix (or exim, if you lean that way) because they really teach you the ropes and also they support maildir format for mailbox storage which makes it pretty trivial to move and backup stuff between installations as needed.
When you get the setup running make absolutely sure your backups are in order. Email is so important for a lot of things that losing your inbox may be a costly mistake. Also set up some sort of server monitoring so that you’ll get alerts if something is not right. Email is pretty resilient, it can easily handle couple of hours downtime from a server, but the longer your downtime is the more you risk of lost emails (senders will get a notification that delivery failed, but it’s up to them to react for it).
There’s a handful of different parts to figure out, but nothing is really that difficult. Sure, you’ll need to understand how email works under the hood and the whole stack is more complex than throwing a jellyfin docker image on your personal server but it’s very much doable. Have fun!















