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: 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.
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.
Surely you get set up everything you need on a VPS though, right? You can even rent a Raspberry Pi in a rack in the UK if you want and that’d work for email, right?
Actually you can just rent a small vps with a provider that allow outgoing port 25 and reverse DNS just to send email. The receive part can be configured in your home server. That’s what I’m trying to do, but I’ve only configured the sending server.
I have both, a VPS with wireguard to bridge it into my network as exit point, and a dedicated bridge from an IPv4 provider.
The latter costs a few bucks and gave me a very reputable IP with rDNS etc.
The former also supports rDNS, but the IPv4 I got was flagged by multiple spam blockers and needed some work to unblock with all those blocklists.
Postfix + dovecot are on my main server behind a residential IP, where I can without problems communicate with clients (IMAP/POP + SMTP) and receive mail (set the IP as MX with lower prio number to force it as first choice for remotes to connect to SMTP with), but not outgoing SMTP (called ‘smtp’ (mail sending/forwarding) in contrast to ‘smtpd’ (mail receiving) in postfix). That’s specifically routed through the IPv4 provider and then the VPS (IPv4), or directly through the VPS (IPv6).
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.
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.
I hear yah, I did the same about a decade ago. I used a howtoforge tutorial from way back then, and its worked well through the years. I host the server at home, and rent a vps with a clean IP that allowed reverse dns to be set on it as my smtp server. Ha! found the link in my bookmarks lol. I am sure there is a better tutorial now a days. Mail in a box might be a good way to go as well.
I use mailcow dockerised.
I configured it asking things to ChatGPT. It works fine but tbh… I use it the minimal possible because I’m scared of being targeted by spammers or worst :)
It’s not as hard as people make it out to be. Sometimes you just end up in people’s spam folder; that’s life.
Some tips:
Maintain the same IP for as long as possible - helps with reputation.
Unless you are in some utopia where your ISP opens port 25 and all the rest, you’ll probably need a VPS. Use a reputable provider. Do your homework. 3. Make sure you can transfer your IP through host upgrades as time goes on.
Make sure your provider will open port 25 and all the rest.
Make sure your provider will set up reverse dns
Check that your IP isn’t on any of the credible spam lists. Don’t worry 'bout UCEPROTECT3 - it’s a shakedown.
fwiw, I have been happy with Hetzner + and mailu.io for my mail server as of late; no affiliation. Going on almost 10 years hosting now.
I’ve been hosting my own email on Hetzner for the last ~10 years. This is good advice. I would add:
Spend some time reading about and really understanding DKIM, DMARC and SPF. These are NOT optional, you need them if you want your emails to have a chance.
You will have to play around with your config to get it set up right. That’s fine, just make absolutely sure you don’t ever forward e-mails from unauthenticated users.
Like others have said, it is not advisable due the administrative overhead, but since you’ve decided to go down that route, there are some good ones here (github.com/awesome-selfhosted/awesome-selfhosted#…), specifically Mail-in-a-box or Docker-mailserver.
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!
I felt the same way about 6 years ago. I host my own on a Linode server (to get a static IP), and I’ve never regretted it. I get blocked as spam here and there, but it’s not nearly the big deal everyone says. There is a lot of FUD around this for some reason.
You don’t need a vps or static ip like others are stating. You can get a port reflector service.
Worth considering is a Secure Email Gateway service which would be where your inbound email is delivered too and check for spam before getting forwarded to your email server. It would also be where your outbound email leaves from.
Last time I looked it wasn’t exactly cheap to host email once you consider the need for a good SEG.
Not sure why you’re upset with email services, but once you start paying for their service a lot of the BS goes away.
Can I ask why you hate switching email services so much? Is it learning something new every time or the hassle of switching over your email everywhere? A lot of people use a domain they own (like emilieeasie@emilieeasie.com) so if they switch hosts they don’t need to update it everywhere, and that might solve your problem, unless something else is bothering you
Personally I think it’s a good idea to be ready to pack and move because of exactly what you said: corpos always gonna corpo.
As others have said, MS, Google, and other major providers are eager to reject or send emails from “unknown” IP addresses to the spam folder. But most people send very little email nowadays and mostly just receive it, so this might not be an issue for you.
In my experience, having SPF, DKIM, and DMARC properly set from the beginning helps a little. Remember to set the PTR record too. At least Mailcow helps with the DNS setup enormously, giving out most of needed values for you just to copy-paste.
Unless you’re lucky enough to have a static IP address and the required ports open by your ISP, you’ll need a VPS. Note that some VPS providers block common email ports as well (to prevent spammers from abusing their infrastructure), or require you to specifically request that the ports be opened by customer support. There’s a useful list of suitable providers here.
I recommend Mailcow. It runs the whole Postfix-Dovecot stack in Docker containers and comes with an easy-to-use admin interface. It’s not the most lightweight solution, but it’s very easy to keep updated with the provided update script.
Can’t help you on how to host the mail server by yourself.
But I’d like to point out that critical and complex infrastructure like a mail server is best managed by a team sharing the administrative load.
With that in mind, organizations like social.coop (which hosts Mastodon and manages it democratically) may be a good solution for you! You don’t have to do it alone, but your voice matters and no decision is made without you. Digital infrastructure cooperatives are a very interesting solution!
I’m pro self-hosting but email is just not critical enough to take on the admin overhead it requires to self-host. Maybe his situation is different and email is more critical in his work/life. If that is the case I would go with the middle ground suggestion provided below which is just to have a custom domain so that switching providers is easy. I would add a FOSS desktop email client so that even when switching providers migration of existing emails is a non-issue.
Almost everyone below downplaying the difficulty is suggesting the use of a vps as a way to “make it easier” or make it work at all. But that defeats the purpose as his main complaint is corpos doing corpo shit. Last I checked VPS providers aren’t mom and pop shops so that’s just kicking the can further down you tech stack. You are still at the behest of your VPS provider and doing significantly more admin task just for email.
Domain registrars are also not mom and pop shops either and neither is the IANA or Internet Service Providers assigning IPv4 addresses… Not totally disagreeing with what you said, but it’s large organizations all the way down.
I personally believe the opposite email is so critical that it is not worth trying to self host.
I do however agree that having your own domain is perfect for it though. Having your own domain name is the way to go, just make sure whoever you go with offers a wild card option so you can make up unique names for everything, you get no spam. And if you change hosts for whatever reason you do not need to setup each email again.
I’ve had only one business ask me this once but probably because I rarely have to interact with people for it.
I did consider this when I got the “throw-away” email domain, made it something that’s easy for people to understand.
It’s probably easier that, if you have to verbally dictate someone an email, you sneak a clue about them in there without it being super obvious. Maybe an abbreviation or a number. Like maybe you call it “gym2@” and not “nameofgym@”. Probably better overall all things considered, and as long as it’s unique it doesn’t really matter.
I rarely talk to people about my email so I have a scheme (pagename_randomlocalslang_threenumbers@reannlegge.ca) when signing up for poop I started using that when I needed a little longer with a “free trial” of something sure I could probably have just gone pagename2@reannlegge.ca, but I wanna say HostHero or some page had rules about how long a email addresses had to be. The only times I have used the businessname@reannlegge.ca was when I deal with the business in person, the first time I had to create the address on the spot and I did not yet have a rondomizer built that I could just wip out and run on my phone, I had to be at home, and the second time it was because I was buying furnature and I knew I was only going to be getting spam on it after the receipt came through so I new it was going to be blocked right away so even if they sold my address no one was going to work out my email address scheme.
I did it for many years and had a lot of pains with corporate servers refusing to accept mail from me simply because I was not a known high volume sender, which to them was enough justification to blacklist me as "close enough to spammer or scammer ".
So much bad mail is attempting to be sent per minute that they’ll discard you just to take the load off their systems. I remember tons of bad mail trying to come to me as well that was being rejected my my server.
Shout-out to stalwart since none have mentioned it and afaik is the most modern solution. Not sure if it’s fully compatible with delta.chat which would be certainly a huge plus!! Mail and instant messenger all in one 🤯
CEO being a dick to employees and forcing the company to become an AI first company and has said that wanting thorough testing of AI code was loser thinking.
Basically just wants employees to churn out slop features.
The fallout of them being called out on this was just a dumpster fire of deleted posts and comments while making employees post from their personal accounts defending the company (pretty badly at that)
Add all this to the support of Trump’s GOP picks and people had had enough to leave.
Acronyms, initialisms, abbreviations, contractions, and other phrases which expand to something larger, that I’ve seen in this thread:
Fewer Letters
More Letters
DNS
Domain Name Service/System
IMAP
Internet Message Access Protocol for email
ISP
Internet Service Provider
IoT
Internet of Things for device controllers
LTS
Long Term Support software version
NAT
Network Address Translation
POP3
Post Office Protocol v3, for email; contrast IMAP
SMTP
Simple Mail Transfer Protocol
TLS
Transport Layer Security, supersedes SSL
VPN
Virtual Private Network
VPS
Virtual Private Server (opposed to shared hosting)
11 acronyms in this thread; the most compressed thread commented on today has 5 acronyms.
Port87 is going to provide a self-hosted stack soon if you're looking for something a bit more turnkey. The guy who runs it is pretty active on the threadiverse, and he's got a killer AI policy (absolutely 0 LLM usage). I believe he's going for the whole deferred open source thing, which may or may not be acceptable for you. Still, I figure I'd bring it up. I've really enjoyed using it in its hosted form.
I think it’s worth shouting out the fellow @hperrin@lemmy.ca and the lemmy community for it !port87@lemmy.ca. In any case, it’s nice to be able to talk to the person behind these efforts on Fedi.
If you wait a little bit, I’m getting Port87 ready to be self hostable. I’m going to open up a public beta program to find any issues. Would that be something you’re interested in?
Will echo others that running your own mail server is a lot of work. If you’re interested in learning, then great, go for it. I’m using Mail-in-a-Box, starting on Digital Ocean. They kicked me off because mail servers were causing them too much trouble. Vultr has been a good experience for years now.
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.
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.
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 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’ve been trying to sign up for about 2 months now with Disroot. I know they had a big incident recently that took up their time, but the “new user” page constantly says they aren’t accepting new users atm and to try back later…
I have a better idea. Give up on email. It’s really only used for spam, or data collecting. I rarely intentionally use email outside of work. So to me, anything that offers some security or privacy are done. Tuta and Proton are just fine for these purposes.
If (when) you decide self hosting isn’t the solution, I suggest mxroute. Lifetime options for reasonable prices, though I got in a number of years ago for $99. Storage isn’t huge for lifetime, but it’s nice to not have to think about it.
I switched to forwardemail and have over 30 @domains there. They are very inexpensive and reliable and their new web base multi account email client is actually usable in emergencies.
Making themselves independent from companies, as they all seem hellbent in turning to shit, lately. I thought that was pretty clear from the topic starter.
I’ve used MXRoute for email before and I’m surprised I haven’t seen this recommended on Lemmy elsewhere. I found out about MXRoute from Reddit many years ago, used it and liked it. No longer a customer for unrelated reasons. The owner is a legit email dude and the service is very reasonably priced with a strong focus on IP reputation. Typically have Black Friday sales, too. Use them (or anything else) instead of self-hosting an email stack!
Most of the struggles with your own email is that you get flagged as spam and it takes time to fix.
So as a first pass, maybe consider hosting receive-only email. What I mean is, use it to sign up for things, but if you need to send an email use another provider. That should let you get used to the whole process without breaking everything.
An alternative approach incase you haven’t gone this far yet - get a custom domain and use that with your email provider to create a portable email like you@youewebsite.com. You get the benefits of someone else handling the infrastructure while having the ability of moving your email to any other provider if you find them troublesome. Moving involves effort of course but at least you are not bound to an @protonmail.com or other address; you remove tge vendor lock-in which is the biggest pain with many of these companies.
It doesnt avoid the faff of having to move but its much easier than maintaining your own email server.
If you really want to do that, stalw.art seems to have every feature you could want and does not seem very hard to install. The community version is AGPLv3. Thunderbird uses it for their new email service.
I had a plan mapped out of how I was going to self host things, I foolishly had a 3 month map of how things where going to going to go. I thought with that I was going to be able to stop paying for services, I have done that, however that 3 months came and went and everytime I needed to use some other service I think hmm can I just self host this? Turns out yes for most things I can.
When it came time for the email section I found many guides, I had my static IP I would use for email because the host I was foolishly using, HostHero, charged an arm and a leg for unlimited emails and offered no wildcard option. I had already at that time been getting away from Apple at that time for a while but liked their hide my email, and very briefly dipped my toes into Proton just prior to hearing about the CEO’s worship of Trump. So I was ready to go self hosting so I got a simple throwawaydomain to test out my system, I asked my ISP to open up port 25 and put the MX record or whatever on one of my static IPs and I was ready. I had nothing but trouble, I would trouble shoot think it was working and no cigar.
I thought I would do a chicken challenge with HostHero to try and get them to turn on a wildcard function for me so I had everything set uo with easyDNS, they would be more affordable and offered a wildcard but I would need HostHero know I was moving hosts so they would release my domain. I was really hoping they would send me to some retention path and I could get some deal that was better than easyDNS. When I called the worker bee I got pretty much just said “ok,” I tried poking asking for the wildcard option and a better plan but got a straight out “no, we will transfer your domain though” so I got the code and went to easyDNS.
Pick mox or Stalwart. Both are one program that does everything (sending, mailboxes, spam checks, admin page), so you skip the Postfix-and-Dovecot pile.
If you want the simplest, mox. Its quickstart asks for your address and prints the DNS records to copy. It's MIT-licensed though, not GPL. If the licence matters most, Stalwart is AGPL-3.0, the closest to what you asked for (a few extras are paid, the mail server isn't).
The catch is the same for either: a home connection usually has port 25 blocked and Gmail distrusts home addresses. So run it on a small rented server (a VPS), where it's still your software and your mailboxes. Before paying, ask the provider two things: will it open outgoing port 25, and can you set the IP's reverse DNS name to mail.yourdomain.
Done looks like: a test to mail-tester.com scores well, and a message to a Gmail address lands in the inbox. Keep your current mailbox until a week of mail has gone through cleanly.
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.
I am hosting my own email server on a rented server for multiple years now. Just recently I stumbled upon this post jan.wildeboer.net/2022/08/Email-1-Postfix-2022/ which has good explanation and even tutorial style command examples.
I don’t know if it would work from a homeland, but as long as DKIM, DMARC and SPF works, I don’t see why not.
Plenty of folks (myself included) seem to manage just fine.
Please stop dissuading people from doing a thing they want to do, if you insist on pointing out potential pain points, frame them as a “be aware of X and Y”, that’s a much more helpful attitude that leaves the agency of choice with the person asking the question.
This is not personal, I’m just a bit fed up with the blind “no don’t” when people express an interest or desire in doing a thing.
My friend who hosted my email domain for years… nearly two decades… was starting to get blocked constantly, and they don’t exactly send you a postcard saying “hey buddy we blocked you.” I just started to notice I wasn’t receiving things I should have, and things I sent never got there.
I agree with the VPS route if you have the appetite for it. I host my own email server on a VPS. And then you can also use it for whatever cool intentions you might have with that VPS. A tailscale exit node that isn’t coming from your home IP is nice way to gain back some level of privacy. Just one example of many other uses. I haven’t found self hosting to be high maintenance like others have suggested.
Lots of good suggestions in the comments. To save time, you can use a one stop setup option like mailcow or server management software like webmin.
If you go the VPS route, it will be hard to find one that doesn’t block port 25. A relay service gets you around that restriction. Many relays also hold your email if your mail server goes down.
Finally, test your setup with tools like mxtoolbox and follow the suggestions to set up SPF, DKIM, etc. When everything is correctly configured, it will take a few weeks for spam filters to stop auto blacklisting your new domain. After the initial config period, maintenance is mostly hands off. Don’t forget to tweak your own spam filters.
I host my email on hetzner VPS and atleast for me after being a customer for a month and paying the first invoice my request to unblock port 25 was approved instantly.
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.
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
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?
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.
Don’t do it. The technical part of email hosting is rather easy but the delivery problems will bite you in the ass. You’ll have to find an ISP which nets are not on any blacklist for Mail, you’ll have to activate every single layer of email security (SPF, DKIM, DMARC, DANE, and maybe ARC) and you’ll still have a lot of problems delivering mails to any of the big providers where most of the people have their accounts.
You could take a look at mailcow, but as I said: the hosting itself is trivial.
Yeah the large providers have slowly turned open email into a closed system. Partly to prevent spam and fraud, but I think partly to build moats so others can’t compete. As it is now, there is a lot of friction trying to do it yourself. Enough that I don’t bother.
I would recommend dovecot and postfix but i haven’t tried any others as these just worked for me.
For hosting i chose a VPS instead of running it at home, i believe at home is a bit harder as you may need a PTR record from your isp, but im not sure.
For a VPS pick a provider that allows for port 25, I use hetnzer which allow it (atleast for me) after one month and paying your first invoice.
Then setup all the DNS records and send a few test mails to mail checker sites.
You don’t need a perfect score, my IP is on one block list for some reason but that hasn’t given me any trouble.
Hosting your own mailserver can be fun but can, and very likely will be, come with a huge can of worms. I host my own mailserver for a handful of domains for roundabout 20 Years now (on a rented virtual server with a “datacenter ip address”) and still run into issues from time to time. Most of those could have been prevent if I had not slept on things like DMARC, DKIM, DANE and such, it is very important to always be aware of new security mechanisms and to implement them.
I would recommend against trying to run a public mailserver on your local server with a residential ip address, because you can’t set a ptr for those and ranges/networks from ISP are all on filter lists, so it is borderline impossible to get any mails delivered.
I’ve set up postfix and dovecot on my VPS a few weeks ago and it was pretty simple. From my testing, popular email providers (outlook, gmail and proton) accept my mail, but corporate mail might bounce because of av (trendmicro in particlular seems to mark VPS host ips as residential/dynamic, you might be able to request removal tho).
Guidelines recommend setting up rDNS and SPF with DMARC for all mail and additionally DKIM for bulk senders. Mail will still be sent to spam, but shouldn’t be blocked. If you are not using it to send mailing lists and writing only to people that are ok with receiving your mail, it’s probably not a problem.
Make sure you configure postfix properly and don’t make it an open relay, as it could be used to send spam.
For receiving, set up something like rspamd to check for inbound spam, verify other sender’s SPF and DKIM. Test your server to make sure they actually work as intended.
For instructions: check mail provider guidelines and read the documentation for your servers before deploying them. Also be careful to not lock yourself out of accounts if you move things to this new mail.
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.
If you’re looking for a decent web interface. Plmail connects to any imap server and is pretty much a Gmail rip off - very familiar github.com/karatektus/pl_mail
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.
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…
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.
Had an issue with one of my website hosts getting this. Had to reply to them 4 or 5 times asking them to justify it, and what do we do to meet their criteria, and they eventually just approved it without explanation.
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.
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.
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.
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 github.com/mail-in-a-box/mailinabox which just installs and configures everything.
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 guide^1^. 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!
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.
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’m using maddy. It bundles everything in one program so you only configure one service and not like 5. I’m using it mostly for receiving mail my infra sends me though.
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. getrealip.net is one of them, see their guide for self-hosting email here: getrealip.net/guides/self-host-email-server/
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.
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.
Besides being bound to their web interface or client apps (no thunderbird) I haven’t found any.
Some folks have complained about service outages or account locks, which is something I haven’t seen in my year and a half using the company, but nearly universally they are revealed to be free users and not subscribed to any tiers of service.
My one and only complaint about my experience inside of using Tuta is a fairly restrictive rules system, after growing up with robust platforms like Ms Outlook. But it’s worth a few Euros a month for me to not use Google and to have excellent calendaring that functions on par with Gcal for me.
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.
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.
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…