from Hacker News

Ask HN: Self Hosting an Email Server?

by fruktmix on 1/29/24, 8:52 AM with 54 comments

It's quite obvious that people HN community loves self-hosting stuff so maybe you guys can help me out here.

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.

  • by dusted on 1/29/24, 1:28 PM

    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.

  • by singhrac on 1/29/24, 3:43 PM

    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.

  • by op00to on 1/29/24, 12:44 PM

    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.

  • by VoodooJuJu on 1/29/24, 1:15 PM

    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.

  • by MaKey on 1/29/24, 1:15 PM

    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

  • by jruohonen on 1/29/24, 8:54 AM

    Cannot recommend: full-time work nowadays; maybe it tells something about email and its protocols too.
  • by somat on 1/29/24, 2:54 PM

    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.

  • by manusia on 1/29/24, 2:37 PM

    "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.

  • by ta1243 on 1/29/24, 2:10 PM

    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.

  • by Lumeinshin on 1/29/24, 1:29 PM

    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.

  • by nijave on 1/29/24, 1:04 PM

    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.

  • by addandsubtract on 1/29/24, 3:16 PM

    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.
  • by rianadon on 1/29/24, 2:39 PM

    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.
  • by ramzez on 1/29/24, 4:37 PM

    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
  • by getwiththeprog on 1/29/24, 9:03 AM

    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.

  • by rubatuga on 1/29/24, 3:05 PM

    https://hoppy.network is an option if you are looking to self host in your home.
  • by landgenoot on 1/29/24, 3:23 PM

    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

  • by kej on 1/29/24, 5:56 PM

    Reminder that Google and Yahoo are both enforcing stronger protections starting next month: https://blog.google/products/gmail/gmail-security-authentica...
  • by nurlennart on 1/29/24, 1:16 PM

    surprised to see no mention of https://mailcow.email/
  • by nhatcher on 1/29/24, 9:45 AM

    I have used cloudron, it's pretty good.