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.
Thoughts and prayers, buddy.
Email is now a cartel.
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 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.
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?
My VPS’ SMTP config used to work and now doesn’t sure to spam prevention shit
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.
Oh, there’s no way in hades I’d host from my LAN. I’d be getting a vhost, 100%
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.
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/
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.
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.
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.
Yes, that’s the point. You have to have an active conversation with a google address. Then your mailbox will be able to land on inbox.
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
deleted by creator
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?
2 domains, 4000+ mailbox, using iredmail pro, running on debian since iredmail still have perpetual license (I think around 2008).
I almost leap in joy when I handover the postmaster account and remove my own email from domain admin.
Wait until the major providers randomly black list you for no apparent reason
How many years should I wait for 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.
I don’t at all fear the technical aspects of self hosting. I fear the administrative aspects. If your server is misconfigured or exploited and it gets used for spam, you have to deal with internet bureaucracies to get yourself off of blocking lists so you can still send and receive email. This happened when my domain was hosted by a buddy of mine. He couldn’t keep up with all the blocks – they don’t necessarily tell you you’re blocked, you just notice that you’re not getting certain emails and other certain emails sent are not received. This is why I ultimately chose to move my domain to Google for better or worse, because at least I know they’re not going to be blocked, and email is something where reliability is a bit more important than independence
Absolutely fair. It is a PITA. I just think I’m better off doing everything I can myself considering the alternative. But believe me, I absolutely get you.
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.
deleted by creator
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!
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.
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.
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.
Stalwart!
A trick I discovered this month. Use the smtp_address_preference flag on postfix to send over IPv6.
If you run your home IP address through the blocklist check on MX Toolbox, you’ll find that almost every home (CPE) IPv4 block is blacklisted. It’s simply not the case for IPv6, and all the big players accept mail over v6.
Apart from that, just make sure to jump through the TLS, DKIM, SPF hoops so other servers don’t reject you. The MX toolbox free stuff has enough to test and verify that it’s right.
I don’t bother with traditional spam filtering. The SPF/DKIM checks catches enough of it.














