I ran my own self-hosted email server from 2008-ish to 2018, and I would highly recommend against doing it! Especially when Fastmail and Proton are so cheap.
I was running Postfix+Dovecot+Seive+SpamAssassin+Fail2ban+certbot+spf+dkim+reverse-ip+<other random crap>
It worked! Receiving email was overall pretty easy. I know I also did things the "hard way" by ad-hoccing all that together, and today there are a lot more out-of-the-box solutions that do all that for you. But still. Being a full-time email administrator is a job I will never do again unless I'm getting paid for it.
You know what really sucked? Deliverability. Frequently, emails I would send would just ... vanish ... no warnings, no errors, no failures. From my end, everything was perfect. Until days later, people would follow up with me and say, "Are you going to send that email?" ...
I had a business IP (Comcast Business). The IP address was clean, not black listed anywhere, not on SORBS or other lists. Still, successfully delivering an email was like 50/50, with no way to confirm the other party actually got it.
Had no problems at all self-hosting for two decades; then a provider went bust and I lost my static IP block, and with it its two decades of reputation.
I still self-host, but now I cheat for deliverability: route the problematic destinations (I'm looking at you, Outlook) through Amazon SES. At a few cents for five-figure numbers of emails, it's as close to free for personal/vanity email quantities as it gets to have someone whose full time job it is to make sure outgoing mail stays deliverable on your side while still keeping everything else under your control.
One thing to note is that Amazon are not very good at keeping amazonses.com up to date, so despite including it you can't set DMARC to hard-fail SPF or you will have mail bounce days.
I'm running 4 email servers, the oldest is from 2011 or so, to this day.
4 different countries, different AS.
I'm always puzzled by all the issues described by others. I had about 4 issues during these 15 years, all 4 were solved by reading the bounce message and doing what was asked in the message (contacting support of the destination).
Same. People just remember it's hard because they don't test, don't like responsibility much and esp. because they test this in production not on a spare domain. Then all you remember from it is the 10 people shouting at you and that you need to fix it NOW and it's all super stressful so they never attempt this again.
I had a Digital Ocean VPS and it was fine about 7 years but on year 8 the entire /24 got blacklisted and it was game over
Took about 6 months of fiddling to get other email services to accept mail DKIM, DMARC, SPF, PTR, web form requests
A lot has changed, in fairness. Stalwart + LLMs can help with the full-time email administrator part. It's a lot easier than it was.
And on the deliverability side, using SES for sending avoids this entirely. Yes, ok, not fully self-hosted I suppose, but it's close enough (and for most people, the bill will be pennies).
I take a middle path. Self-host receiving mail, and use smtp2go.com for outgoing
Yes, I do something similar (with Amazon SES in my case) but only for domains I know are problematic (Microsoft-hosted domains are the main difficulty - I've never had issues with eg Gmail).
How do this work? Do you need to use two different programs to send and read email?
Well, generally you need 2 different programs regardless. Usually an SMTP server for accepting and storing emails and a IMAP server for clients to connect to and read stored emails.
For the parent post, you configure an outgoing SMTP relay
Iirc called smarthost in postfix
You could do it any way you like, but it you have your own mail server, just configure it to route specific recepient domains (or all domains, this is called a "relayserver" in the postfix documentation) to a specific mail server. Just remember to flag your desired outgoing mail servers as approved for your domain (in the SPF record).
It's moslty due to how the protocol works. Sending and Receiving are asynchronous and may or may not follow the same path.
When sending the other side is the server, when receiving, you are the one. The protocol also has the concept of relaying, where message can go trough intermediary nodes.
So you can set one server for receiving email (yours) and another one for sending (smtpgo).
For actually reading, the server for receiving need to deliver the message (either built-in feature or through a program) to the correct mailbox. That would probably means writing it on disk somewhere. And then you need to use a mail user agent (MUA) to read that file. Protocol like imaps and pop3 are for transfering your inbox to another computer, not for receiving or delivering email.
Yes I figure if I’m going to pay someone to resolve a domain to an IP address I might as well pay the same person to operate my mailbox. Having clients that sync the mailbox offline is “local” enough for me.
This seems to depend so much on the IP address space one is in. I have never experienced deliverability issues after the first year–and that's since the 2010s iirc. The first year I had to ask several friends to send me emails first, or dig out my email from spam and reply to it. After that it worked flawlessly for Gmail, which was hit-or-miss before. A single ISP I had to write to manually–the person responding to my mail explained that they blocked emails from my hoster's IP range wholesale but made an exception for my IP explicitly.
Never had any issues since then, though I did have to adjust to new standards such as DKIM, DMARC, SPF etc. over the years.
That’s something I have hard time explaining to the business.
Yea we do all the best practices but still no one can guarantee 100% deliveries. Just not possible for e-mail.
Yes we can have 100% over a year but after that it still is a lottery, can’t say anything about future not having suddenly 40% not delivered
I think the timeline is critical here and should be highlighted. Self hosting email server was something that worked out just fine in the past (used to host until 2014), however things have changed a lot with the scale of abuse. its not worth it unless you are doing it as a business. Sending a email from your home IP to big email providers with reliability is next to impossible. Even if we discount the spam management,
1. IP reputation is a big deal, its not just about not being on some blocklist, call it a cartel at this point, its about being on the allow list for other mail providers
2. Keeping it reputable is a continuous effort
The importance of IP reputation is a reason for why email isn't using IPv6 much.
I have had my own e-mail server since 2017, and there is only one instance where I know I had a delivery problem, and in that case it was funny, because I wrote to two people who had the same e-mail server, and one got the e-mail the other did not. So probably a SPAM issue, but certainly nothing my e-mail server could have done better...
AFAIK, that case in 2019 was the only time an e-mail went missing.
you can check your delivery rate with services there are lots that are free to check and they also offer to "warm" your reputation. I have not done that yet (money!) and outside this:
- Outlook.com consumer mail addresses
you can still get >99% delivery rate if you have spf, dkim and all the new cool stuff.
So no, please DO NOT recommend against doing it because ONLY if mail stays a decentralized service providers will stay forced to not blacklist everything but other large providers.
I used to run mail servers for a university and I also suggest that no one should do this. It's hard enough to get right when it's your full time job. No one wants that kind of headache just for an email address. Do what I do and pay for Proton and stick your domain on it.
"Hacker"news: Don't actually do it yourself man, just pay someone!
Running your own email infra is not at the same level as the usual “self hosting”. Not to mention that email can be critical and missing an important email can burn a lot. Why put in that much effort on your free time, and take the risk?
You don’t build your own fridge. If it’s important and not your strong suit, pay someone to do it for you.
Have you actually measured delivery rate of some service vs. doing it yourself?
Will second this, as someone that took the same path. Alternatives like Fastmail are so, so cheap when compared to the headache of building, maintaining, and troubleshooting a DIY stack. For something as fundamental as email you really want to choose the solution that gives you NO problems, rather than some solvable but troublesome problems at regular intervals.
Just too critical of a component in most people's lives to accept any level of unknowns in.