Ask HN: Self Hosting an Email Server?
57 comments
I'm still self-hosting.
I have a server in my home, on my private internet connection, it runs postfix and dovecot.
It works fine. But beware: Sending mails become a hassle as your ISP might block outgoing mail on port 25, you'll need to convince them to provide you with the details of their relay machine. On my connection, I needed the correct reverse-dns entry to be present for their server to actually relay for me, this proved hard because their support didn't understand that THEY were the ones in control of rdns, they only knew about forward-dns.. It took me some linkedin sniping and a nontrivial amount of social engineering to infiltrate their netops enough to find a guy that I could convince to add the rdns entry. It was very painful.
It was in sharp contrast to when I joined the Internet around the turn of the century, on my ADSL, the ISP had a polite letter apologizing for blocking outgoing port 25 and full indstructions on how to use their relay host, even a few lines on how to configure exim to use it.
A slightly convoluted way of getting out, that I had to resort to during aproblem at my ISP, was the following: http://dusted.dk/pages/aWayOut/ where I basically used a cheap VPS as a "gateway to the Internet" for my server.
I have a server in my home, on my private internet connection, it runs postfix and dovecot.
It works fine. But beware: Sending mails become a hassle as your ISP might block outgoing mail on port 25, you'll need to convince them to provide you with the details of their relay machine. On my connection, I needed the correct reverse-dns entry to be present for their server to actually relay for me, this proved hard because their support didn't understand that THEY were the ones in control of rdns, they only knew about forward-dns.. It took me some linkedin sniping and a nontrivial amount of social engineering to infiltrate their netops enough to find a guy that I could convince to add the rdns entry. It was very painful.
It was in sharp contrast to when I joined the Internet around the turn of the century, on my ADSL, the ISP had a polite letter apologizing for blocking outgoing port 25 and full indstructions on how to use their relay host, even a few lines on how to configure exim to use it.
A slightly convoluted way of getting out, that I had to resort to during aproblem at my ISP, was the following: http://dusted.dk/pages/aWayOut/ where I basically used a cheap VPS as a "gateway to the Internet" for my server.
Sendmail and POP3/dovecot here, and a small static IP address block and a business service plan that allows server hosting. And yes, rDNS got more fun when I was no longer managing whole class Cs!
There's also Mail-in-a-Box: https://mailinabox.email/
Also take a look at Stalwart: https://github.com/stalwartlabs/mail-server
I haven't used it, but have used some of the sub-crates for some email-parsing problems, and it worked great.
I haven't used it, but have used some of the sub-crates for some email-parsing problems, and it worked great.
I enjoy running my own mailserver, Mainly because I know how and can tolerate delivery issues. However I don't think it is less expensive than a managed email service. I host it on a virtual server I am paying ~$10 a month for. I do other things with that server so it is hard to say exactly how much the email costs.
if interested, my stack is very simple:
openbsd: opensmtpd: opendkim
To read mail I ssh in and use mutt. imap via dovecot is an option I have used before. however because I using mutt anyway. ssh/mutt is a lot easier to set up.
I have not needed spam protection yet, when/if I do I will plug in rspamd and openbsd's native spamd.
I use https://openbsd.amsterdam/ as my vhost. I don't know if I could really recommend it to others. it is this effort to emply openbsd's native vmm as a service. The down sides: performance is not that great, it goes down twice a year for host updates. It is run by one person. The upsides: That person does a really great job at customer service. stable ip/ip6 address, reverse pointers. ssh based vm control.
if interested, my stack is very simple:
openbsd: opensmtpd: opendkim
To read mail I ssh in and use mutt. imap via dovecot is an option I have used before. however because I using mutt anyway. ssh/mutt is a lot easier to set up.
I have not needed spam protection yet, when/if I do I will plug in rspamd and openbsd's native spamd.
I use https://openbsd.amsterdam/ as my vhost. I don't know if I could really recommend it to others. it is this effort to emply openbsd's native vmm as a service. The down sides: performance is not that great, it goes down twice a year for host updates. It is run by one person. The upsides: That person does a really great job at customer service. stable ip/ip6 address, reverse pointers. ssh based vm control.
"I want to be able to send and receive emails from my custom domains but not pay 5-49$ a month in doing so."
If that's the goal, I usually just use https://forwardemail.net. Not self-host, but a forwarding service.
If that's the goal, I usually just use https://forwardemail.net. Not self-host, but a forwarding service.
Another recommendation for this. I've been using this method for a few years now with no complains.
This seems like a very affordable and stable solution to be honest.
I in general like to self host, but more importantly I don't want to be locked in.
I pay zoho £10 a year to host my email. I could do it via my ISP, I have a good one which doesn't have port blocks, offers as many IPs as I can imagine I need, and is shibboleet compatible, but even setting aside my own time and maintenance, I'd want two MX entries that were geographically resilient, so I'd need to rope in a friend or family member. For £10 a year it's not worth it.
However if zoho stops working, or bumps their price up, I can shift my domains to someone else with a change of MX/spf/etc records.
Only concern is that all 3 zoho entries are on the same AS (zoho), so that's a single point of failure. Not a major concern for personal email.
I pay zoho £10 a year to host my email. I could do it via my ISP, I have a good one which doesn't have port blocks, offers as many IPs as I can imagine I need, and is shibboleet compatible, but even setting aside my own time and maintenance, I'd want two MX entries that were geographically resilient, so I'd need to rope in a friend or family member. For £10 a year it's not worth it.
However if zoho stops working, or bumps their price up, I can shift my domains to someone else with a change of MX/spf/etc records.
Only concern is that all 3 zoho entries are on the same AS (zoho), so that's a single point of failure. Not a major concern for personal email.
€0,90/month at Zoho for Mail Lite right? How many domains can you setup with that? Their pricing page doesn't mention that
https://www.zoho.com/mail/zohomail-pricing.html
Other than that, I must say that Zoho is probably the cheapest option out there.
I am using it right now (for free) but I can only setup one custom domain.
This whole conversation have gotten me quite excited to see how good my ISP is so I have just ordered a RPi to try setup a email server at home (for fun).
Service : Zoho Workplace
Plan : Mail Lite
User : 1
Payment Duration : Yearly
Start 11 June 2023 End 10 June 2024
Last year they charged me $1/month plus VAT. Not something I notice
I have two domains pointing there. Not sure how many I can have, but the domain renewal costs more than the mail.
I would rather spend $10 with a small(ish) internet company than $1 with a leviathan like apple or amazon. In reality I spend far more with the behemoths, but as far as I'm concerned every dollar I spend with a small company is a dollar invested in not making email the sole remit of microsoft and google.
Last year they charged me $1/month plus VAT. Not something I notice
I have two domains pointing there. Not sure how many I can have, but the domain renewal costs more than the mail.
I would rather spend $10 with a small(ish) internet company than $1 with a leviathan like apple or amazon. In reality I spend far more with the behemoths, but as far as I'm concerned every dollar I spend with a small company is a dollar invested in not making email the sole remit of microsoft and google.
For resilience I keep some third-party accounts open, including an ancient Hotmail account from before it was Microsoft (!), and now a university account. Either would do in an emergency to some extent (like when my upstream ISP years and years ago held me hostage by blocking my email traffic with Network Solutions so that I could not move DNS!)...
It mostly depends on if you want to have a web frontend or are happy to just login to thunderbird/sylpheed or other application.
This still gets updated and works quite well: https://github.com/LukeSmithxyz/emailwiz it installs dovecot/spamassassin etc for you, so i guess i'm more vouching for the RPi. I think a 5$ VPS would be worth it, you can probably run other stuff on it too like XMPP
Only note to it i'd add is that depending on your domain name provider, you may have some issues with DKIM/SPF, but otherwise it should be fine.
This still gets updated and works quite well: https://github.com/LukeSmithxyz/emailwiz it installs dovecot/spamassassin etc for you, so i guess i'm more vouching for the RPi. I think a 5$ VPS would be worth it, you can probably run other stuff on it too like XMPP
Only note to it i'd add is that depending on your domain name provider, you may have some issues with DKIM/SPF, but otherwise it should be fine.
I use MXroute for my email. I pay for one plan and can use it with unlimited(?) domains. So good and reliable enough for all my hobby projects that need a contact address.
$49 /year is putting me off to be honest. Zoho offer is 1/5 of that price.
I've been using https://mailinabox.email on a small VPS where I host a few other websites and projects. I'd recommend it for the management aspect: It has backup scripts and a UI for let's encrypt and dns entries.
I thought of running one on synology, but then thought if my static ip gets blacklisted for some stupid reason it can cause all sorts of problems, so I just started using purelymail.com
Fairly cheap, very similar pricing to Zoho, gonna look it up!
What sorts of problems would occur if my static IP gets blacklisted?
https://hoppy.network is an option if you are looking to self host in your home.
Not self hosting, but way cheaper than 5-49 USD per month:
I had good experiences with Infomaniak. Their email service can be used while the domain is registered somewhere else.
1.50 EUR per month for 5 addresses and unlimited storage, modern interface + imap, carddav, caldav, hosted in CH.
https://www.infomaniak.com/en/hosting/service-mail
I had good experiences with Infomaniak. Their email service can be used while the domain is registered somewhere else.
1.50 EUR per month for 5 addresses and unlimited storage, modern interface + imap, carddav, caldav, hosted in CH.
https://www.infomaniak.com/en/hosting/service-mail
Reminder that Google and Yahoo are both enforcing stronger protections starting next month: https://blog.google/products/gmail/gmail-security-authentica...
Fingers crossed these types of changes will lower reliance on IP rep
Cannot recommend: full-time work nowadays; maybe it tells something about email and its protocols too.
Is it? My mail continues to work after initially set up long time ago (decade or two): sure, some of my emails end up in spam for new gmail recipients, and figuring that out would be a lot of work, but still not full time work.
“Some of my emails end up in spam for new gmail recipients”
You don’t see a problem with this?
You don’t see a problem with this?
I'm sure it's a problem, and the degree of "problem" depends on the importance of the mail.
I think the real problem is that we are delegating to google the arbitrary decision of what is spam or not. Given that their core business in great part relies on syphoning info from users' mails, they have zero incentive to let users host their own servers and potentially bypass that data collection, and an actual incemtive to block as many domains as they can, for the sake of "safety"
I think the real problem is that we are delegating to google the arbitrary decision of what is spam or not. Given that their core business in great part relies on syphoning info from users' mails, they have zero incentive to let users host their own servers and potentially bypass that data collection, and an actual incemtive to block as many domains as they can, for the sake of "safety"
I do, but spending more time ("full-time work") on it won't solve the problem, which is what I replied to.
The problem seems to be that Google does not even keep a reputation for my extremely low volume mail server, and the solution might be to set up automated emailing a couple of @gmail inboxes and marking-as-not-spam all of them there.
Even that wouldn't be full-time work.
The problem seems to be that Google does not even keep a reputation for my extremely low volume mail server, and the solution might be to set up automated emailing a couple of @gmail inboxes and marking-as-not-spam all of them there.
Even that wouldn't be full-time work.
> Cannot recommend: full-time work nowadays;
Interesting. Care to elaborate on what makes self-hosting email such a time-consuming task? Most of the replies you're getting seem to suggest it's not that hard to pull off.
Interesting. Care to elaborate on what makes self-hosting email such a time-consuming task? Most of the replies you're getting seem to suggest it's not that hard to pull off.
IP address reputation.
> IP address reputation.
Care to elaborate? We already had other comments stating it's not a problem. I would love to hear some first-hand accounts substantiating these claims.
Care to elaborate? We already had other comments stating it's not a problem. I would love to hear some first-hand accounts substantiating these claims.
Basically if someone clicks that your email is spam, your IP address gets put on a list. You have to pay or fight to get off those lists.
What makes that a full-time job?
You need to beg Microsoft to whitelist your IP once in a while
I've been hosting my email since the 90s, and it still basically just works.
Currently sendmail and dovecot on a (off-grid) RPi that I use for a bunch of other services too.
Currently sendmail and dovecot on a (off-grid) RPi that I use for a bunch of other services too.
Yeah, I've seen it's a big hassle but I reckon these open source alternatives helps?
> Yeah, I've seen it's a big hassle
A huge hassle, in fact. Even with robust exchangers, like Postix, and careful all around hardening, you are going to get a fight of your life.
A huge hassle, in fact. Even with robust exchangers, like Postix, and careful all around hardening, you are going to get a fight of your life.
It's so weird how whenever this topic comes up on HN, a bunch of people appear who all say 'nope, impossible, don't even try, you'll never achieve reliable delivery to [2 big names]'
Meanwhile a bunch of other people are saying 'despite many people here reporting issues, once I got the software installed, it works fine for me'
Really makes you think
Meanwhile a bunch of other people are saying 'despite many people here reporting issues, once I got the software installed, it works fine for me'
Really makes you think
Good point. I think that one of the things that got this discussion to fire up was that I didn't say that I didn't mind my emails going to spam box (I know it's very tricky getting whitelisted). And I think, some of those who say 'nope, impossible' is referring to getting whitelisted while those who say 'works fine for me' are people fine with not being whitelisted.
> while those who say 'works fine for me' are people fine with not being whitelisted.
I mean, my working theory here is that it's easy to get whitelisted - in fact you'll probably be whitelisted by default if you have working DMARC and DKIM etc - but companies who operate large mail installations also operate AI 'agents' that aim to drive traffic and users towards their service. That includes spreading negative sentiment i.e. convincing users on forums that setting up their own mailserver is an impossible task and that they'll never be able to achieve delivery etc.
Of course I could be wrong.
I mean, my working theory here is that it's easy to get whitelisted - in fact you'll probably be whitelisted by default if you have working DMARC and DKIM etc - but companies who operate large mail installations also operate AI 'agents' that aim to drive traffic and users towards their service. That includes spreading negative sentiment i.e. convincing users on forums that setting up their own mailserver is an impossible task and that they'll never be able to achieve delivery etc.
Of course I could be wrong.
I think it depends a lot on also, what you use your email server for. I never had a problem, but it's for my personal mail only. Very low traffic.
Meanwhile, if you use it for marketing or something, I think more things can go wrong.
Meanwhile, if you use it for marketing or something, I think more things can go wrong.
Sure it's a big hassle if all you want to do is get your email. But it's still a great way to learn how to administer email if you intend to get a sysadmin or ops job.
It's time new something new. Why cling the the days of yore?
[deleted]
[deleted]
If you are interested in it, go for it.
Super easy to set up, quite difficult to harden if you run across any problems.
You can always transfer your custom domain to another host when you want to.
Super easy to set up, quite difficult to harden if you run across any problems.
You can always transfer your custom domain to another host when you want to.
I listed a few alternatives in the OG description. What do you recommend?
I have used cloudron, it's pretty good.
You will have nothing but misery self hosting email. If you care about your email, you know the reliable options.
Source: ran “self hosted” email using open source tools for 12,000 person university campus for many years.
Source: ran “self hosted” email using open source tools for 12,000 person university campus for many years.
I've used postfix+dovecot for a while and it's fairly easy. Main issue is you need a static IP (not on a consumer/residential subnet) with reputation. To be safe, you really need a /24 subnet since some blacklists will lost entire net blocks if they get enough complaints.
Even with DKIM, SPF, DMARC, and a PTR record, it was quite difficult to get Outlook/Microsoft to accept emails without them going to spam. I think they have some sort of form you can submit but it took lots of tries
If you don't have a static IP, you have to pay for a relay.
Even with DKIM, SPF, DMARC, and a PTR record, it was quite difficult to get Outlook/Microsoft to accept emails without them going to spam. I think they have some sort of form you can submit but it took lots of tries
If you don't have a static IP, you have to pay for a relay.
I've been running mailcow [1] on a Hetzner cloud server for a few years and am pretty happy with it.
[1] https://mailcow.email
[1] https://mailcow.email
+1 for mailcow. Running it for half a decade on a vultr box.
I see people saying self-hosting email is difficult - I disagree. If you know what a DNS record is, how to SSH into a server, and how to run a docker container, then self-hosting email will be easy for you. Postfix and Mailcow make it quite simple these days.
The problem with self-hosting is that even after setting up everything correctly, you will still likely run into delivery issues with your outgoing mail because your IP doesn't have the right reputation, i.e. it's not associated with a globocorp. What will follow is a cat and mouse game of contacting the various big email providers and asking/begging/demanding them to whitelist your IP so that they don't send your mail directly to spam. The responses to these whitelist requests vary between being ignored and being temporarily whitelisted.
Many consider this to be a losing game and give up self-hosting email.
If you can get through to legal departments, you may have better and more permanent success in getting whitelisted, see: https://news.ycombinator.com/item?id=30225619
But you might want to just sign up for a cheap email provider like Fastmail. If you self-host, you'll likely spend at least $5/mo for the VPS anyway, and if you have 100 or fewer custom domains, Fastmail is just under $5/mo, so I'd say that's a better deal than self-hosting.
The problem with self-hosting is that even after setting up everything correctly, you will still likely run into delivery issues with your outgoing mail because your IP doesn't have the right reputation, i.e. it's not associated with a globocorp. What will follow is a cat and mouse game of contacting the various big email providers and asking/begging/demanding them to whitelist your IP so that they don't send your mail directly to spam. The responses to these whitelist requests vary between being ignored and being temporarily whitelisted.
Many consider this to be a losing game and give up self-hosting email.
If you can get through to legal departments, you may have better and more permanent success in getting whitelisted, see: https://news.ycombinator.com/item?id=30225619
But you might want to just sign up for a cheap email provider like Fastmail. If you self-host, you'll likely spend at least $5/mo for the VPS anyway, and if you have 100 or fewer custom domains, Fastmail is just under $5/mo, so I'd say that's a better deal than self-hosting.
surprised to see no mention of https://mailcow.email/
I want to be able to send and receive emails from my custom domains but not pay 5-49$ a month in doing so.
What options do I got?
Saw these alternatives but I don't know what you guys recommend.
- https://www.cloudron.io/index.html
- https://cyberpanel.net/
- https://www.hmailserver.com/
- https://wildduck.email/
- Sendmail and dovecot on a (Rasberry PI) RPi
- https://www.makeuseof.com/make-your-own-raspberry-pi-email-server/
To clarify, I don' t mind the UI looking like it's a website from 1998. I just want to be able to read and send.