Advice on Self-Hosting Mailserver reddit / selfhosted ---------------------------------------------------------------------- Phantasmagoriosa · 2023-10-24 18:35 Hi, Am evaluating all options for self-hosting my own mailserver. I am probably looking to host it in GCP or AWS, as I don't want to worry about availability on a really small VM ​ Would really appreaciate any recommendations from the combined wisdom of this subreddit, on what the most ideal stack to self host would be and any tips to not make any silly security errors. ​ Would be nice to solve a couple main problems, the main one being, I have older backups in a few different formats, .pst, .olm and .mbox. I want to bring all of these together, in one mail account *and* have them searchable and syncable to devices. Is there a mail server that can even import all these formats? I know email clients can import but I've never imported into a server. I'm guessing I could import into a local client then sync to the server somehow? ​ Did have it so that these mailboxes were imported on one of my PCs in Thunderbird. Oh my god was that awful, the search is absolutely shocking and most of the time, when you need to find an old email you are not at home, sat by the desktop computer. Am really looking for something with a somewhat decent Web mail interface, I use webmail alot right now. Doesn't have to be Gmail level smooth, but more than anything I just want search to be good. Fast, presented well and accurate/smart. Came across [AnonAddy](https://anonaddy.com/) [Source Code](https://github.com/anonaddy/anonaddy) which seems like such an amazing idea that I've never come across before, so would love to integrate that into the solution. If anyone is aware of incompatibility between this and certain self host servers would appreaciate the heads up Not too sure about spam-filters and email AVs. I'm not too clued up on that, obviously I would like to avoid spam and that anonaddy thing might go a long way but if the mail server just has basic rules and sweep features that would be good enough. ​ Not too worried about the privacy / encryption focus I've seen on some self-hosted mailservers. Moving to my own mail server must be somewhat better than what ms/google are harvesting from me data wise at the moment. Even if it is in their cloud. ​ What is everyone's experience of these?: [docker-mailserver](https://docker-mailserver.github.io/docker- mailserver/edge/) [iRedMail](https://github.com/iredmail/iRedMail) [Maddy Mail Server](https://github.com/foxcpp/maddy) [Mailinabox](https://github.com/mail-in-a-box/mailinabox) [Mailcow](https://mailcow.email/) [Mailu](https://mailu.io/) [Modoboa](https://modoboa.org/en/) [Postal](https://docs.postalserver.io/) ​ Also is there any mileage in running the web mail client separately? Do they have better search and UX than any of the built in ones? [cypht](https://github.com/cypht-org/cypht) [Roundcube](https://roundcube.net/) Thanks in advance ---------------------------------------------------------------------- thekrautboy · 2023-10-24 18:45 The general consensus is that its not worth the headache to selfhost email. ---------------------------------------------------------------------- Hoongoon · 2023-10-24 18:48 Mailcow works perfectly fine and is easy to set up. ---------------------------------------------------------------------- phein4242 · 2023-10-24 18:50 Have a look at mailcow if you’re new to MTA’s. Use that and a (sub)domain to figure out how to set things up. Once youre satisfied with the setup, reconfigure your domain on the new MTA. Use a mailclient with $yourformat and imap support to import your old email. And above all, dont be discouraged by the naysayers that think its an impossible task; Its not, but it is complicated to get right bc all the parts involves ;-) ---------------------------------------------------------------------- thekrautboy · 2023-10-24 18:50 You think hosting email only involves installing the software? ---------------------------------------------------------------------- jusepal · 2023-10-24 18:56 If you're going to selfhost anonaddy (or simplelogin, since both are rather similar) then you wouldn't need to selfhost a full blown mailserver anymore. You pick either one, not both. Anonaddy and simplelogin will act as a relay and would forward the mails to somewhere else, usually the mainstream hosted providers gmail, yahoo, proton, tuta etc and those providers will be the one that actually stored the final mail. Relaying to a full blown mailserver hosted yourself would totally negate the point of both anonaddy and simplelogin. Most full blown mailserver also can act as anonaddy/simplelogin with their built-in alias manager so it'll just overlap. ---------------------------------------------------------------------- bz386 · 2023-10-24 18:58 The first thing you will have to figure out is a SMTP relay host, as both AWS and GCP block outgoing connections on port 25. With AWS you can use SES, but with GCP you will have to go either third party service. ---------------------------------------------------------------------- Phantasmagoriosa · 2023-10-24 19:13 Damn, okay that is a really good stumbling block to know. ---------------------------------------------------------------------- ex0thrmic · 2023-10-24 19:14 I self host and it wasn't a hassle at all. Only issue I had was getting my VPSs IP unblocked by Microsoft. Which took one email to their support team and they happily obliged. ---------------------------------------------------------------------- Hoongoon · 2023-10-24 19:14 Do you? ---------------------------------------------------------------------- ex0thrmic · 2023-10-24 19:14 I used Luke Smith's emailwiz script. Postfix, dovecot and everything. Works wonders. https://github.com/LukeSmithxyz/emailwiz ---------------------------------------------------------------------- thekrautboy · 2023-10-24 19:15 No i dont, a bit more than that is involved which i why is usually considered a headache. But feel free to provide your advice to OP directly. ---------------------------------------------------------------------- Hoongoon · 2023-10-24 19:20 My experience exactly. It's fairly easy to set up. I totally switched to self host email 100% two years or so ago and never looked back. ---------------------------------------------------------------------- donaldcjackson · 2023-10-24 19:20 I use IRedMail. Not too difficult to install and maintain. They have instructions for getting/renewing Let’s Encrypt certs. Includes Roundcube, which I rarely use. ---------------------------------------------------------------------- Hoongoon · 2023-10-24 19:23 >No i dont, a bit more than that is involved which i why is usually considered a headache. It's all in the setup guide of mailcow. ---------------------------------------------------------------------- thekrautboy · 2023-10-24 19:24 I know, thanks tho! ---------------------------------------------------------------------- Phantasmagoriosa · 2023-10-24 19:25 Okay, good to know, I did see some of those mailservers mention alias'ing but hard to know what they do/don't do. I think I maybe didn't do a good job of emphasising in the post but in a sense it's not actually a mail server I'm looking for. Its more like a place where I can archive and search through my emails historically if that makes sense? Like all emails older than a year that just get "somehow synced" from my mail big provider email to this place But it seems that if I want to have that library of emails syncable and searchable across devices, I have to put them within a mail server. Theres nothing which is the equivalent of nextcloud / syncthing for emails you know? ---------------------------------------------------------------------- yarmak · 2023-10-24 19:34 I stopped self-hosting email when reputation of hoster's network went down and I found myself in blacklist. Even if you're not sending spam, others do. Even if you handle technical matters, you can't have influence over inclusion into blacklists. So my overall experience was: it worked fine until it didn't. ---------------------------------------------------------------------- Phantasmagoriosa · 2023-10-24 19:34 Appreciate the straightforward advice here. I think some people have taken it that I have a burning desire to host email for day to day use but seems like you got it. Am more looking for something I guess you could describe as an "email archive". Do you think this is the only way to get what I'm looking for? All these old emails, making them searchable / syncable to different devices with someway of like periodically importing new batches to them? ---------------------------------------------------------------------- jusepal · 2023-10-24 19:34 Then you probably wanted an email archive and backup solution, not a full blown email server. It'll act as a client pulling all your mails via pop or imap then achive it. Even traditional email client like thunderbird can do the job just fine. Hosting a full blown email server just for archiving is overkill since you'll be dealing with outgoing mails. Outgoing mails headache of going into spam or being blackholed into oblivion is exactly why most would advise against selfhosting a full blown mail server. ---------------------------------------------------------------------- Phantasmagoriosa · 2023-10-24 19:43 Yeah that would be great! Maybe I'm just not looking in the right places or I haven't found the right googlefu to unlock the thing I'm looking for. But all of the software categorised as email archive is like local client based things that pull all your emails and squish them into this single file for storage and backup. Do you know of some archiving software / lib that allows you to access/search these old emails over the web on mobile devices, etc? ---------------------------------------------------------------------- ex0thrmic · 2023-10-24 19:44 I just got lucky I presume. I have a trust score of 100 and my server's IP isn't on any blocklists last time I checked. My host blocks SMTP by default and you have to open a ticket to have the block removed. Little spam runs through their network I guess ---------------------------------------------------------------------- moontech704 · 2023-10-24 19:48 I don’t think anyone has said it’s impossible, just that it’s not really worth it other than the experience of setting it up. Maybe 15yrs ago it was worth it as finding email hosting for your own domain was more difficult or fairly expensive. Now it’s cheap and reputable hosting providers are abundant. Reliable email is mandatory for me and I think it’s better to let someone else worry and focus my time on other things. ---------------------------------------------------------------------- Minute_Earth3357 · 2023-10-24 20:07 Here's what I do: I have a vm running sophos fw (free version) - this public facing and filters for spam and virus. Then legit e-mails get sent to my SmarterMail VM (Also using free edition) from the Sophos. ---------------------------------------------------------------------- thekrautboy · 2023-10-24 20:17 Exactly this. ---------------------------------------------------------------------- phein4242 · 2023-10-24 20:27 Not wanting to have the responsibility to deliver mail is fair and it makes sense. The thing I disagree with, is the maintenance cost. Given a full spf+dkim+dmarc setup (one-time set and forget) the only thing you really need to worry about is reputable ipspace, and that can be hard to find depending on your budget and/or who you know. Once you have the reputation sorted, delivering email to the inbox on google, microsoft etc works flawlessly ---------------------------------------------------------------------- GWBrooks · 2023-10-24 20:46 ::::aggressively ignoring all the don't-host-your-own-mail nonsense:::: Mailinabox is my go-to for exactly your use case -- a multi-domain, relatively low-volume (<10k messages a month) mail server hosted on a low-end cloud VPS. I even use Digital Ocean, which I was \*assured\* was the kiss of death. Across several years of doing this, I don't have an IP-rep problem or delivery issues outside of the two noted below. Pros: Simple install, modern requirements like DNSSEC are met, easy interface. Built-in nightly backup is a nice touch. Cons: Not as polished as some other options. Also, because mailinabox uses (and only uses) the most up to date TLS versions, mail to [att.net](https://att.net) and [bellsouth.net](https://bellsouth.net) (which both run ancient, legacy mailservers) won't go through because my server can't establish a secure connection. That's not a deal killer for me, but it might be for others. If you wanted to avoid the issue of IP reputation (and, along the way, the delivery issue I mentioned with ATT/BellSouth), then there's a fork of Mailinabox on github -- Power Mailinabox -- that adds support for SMTP relaying. Throw in some Amazon SES credentials and you're out of the IP-reputation-headache business. (Sidebar: Hestia control panel, which uses the Exim mail server, has per-domain controls for third-party SMTP. If that's important to you, that may be another option.) ---------------------------------------------------------------------- olluz · 2023-10-24 20:51 I use Proxmox Mail Gateway (as a mail gateway) and I can only recommend that. It keeps spam at nearly zero and it is very lightweight and easy to set up. Plus it gives you flexibility where and how to host the actual mail server. Microsoft has blacklisted most IPs so you'll most probably need to send them a message to whitelist your mail server or gateway once everything is configured correctly. If you're looking for a more than just plain mail check out solutions like Grommunio and Axigen. Some commercial solutions have free versions with minor limitations. Importing old emails can be done via the client and not directly at the server. There are good solutions for mail archiving and searching (like Mailstore). I'd use that for mails older than two years. While I like to idea of AnonAddy and I understand your reasons, I just don't think it is worth the hassle. Eventually your "real" email address will somehow end up in spammers list, but a good spam filter, like the one in Proxmox mail gateway will keep your mailbox clean. All in all, self hosting a mail server is a bit of work in the beginning, but definitely doable. ---------------------------------------------------------------------- taxigrandpa · 2023-10-24 21:07 I host a MailInABox on AWS. it's got it all, web mail, push functionality, multi tenant, spam filtering. ---------------------------------------------------------------------- taxigrandpa · 2023-10-24 21:10 totally false. AWS will allow you to use port 25 if you meet some extra criteria (Live in the US, understand what your doing and not be a spammer) ---------------------------------------------------------------------- talent_deprived · 2023-10-24 21:40 >Reliable email is mandatory for me This is why I selfhost my email, actually, that and privacy. ---------------------------------------------------------------------- talent_deprived · 2023-10-24 21:42 I hosted on AWS for several years until recently, as long as you request they allow SMTP, they will. ---------------------------------------------------------------------- Ziomal12 · 2023-10-24 22:14 I've recently started selfhosting email using docker mail server and honestly it's quite straightforward. I have it on my server at home, all outgoing mail leaves using my home it (and honestly I'm quite impressed because I am behind CGNAT) and incoming mail goes (as the rest of my incoming traffic) through oracle vps via Haproxy (with proxy protocol) This might sound complicated but honestly I had vps setup earlier so the "extra work" I had to put in was adding few ports to haproxy config using my existing config as a template (had to add like 2 ports) ---------------------------------------------------------------------- Droophoria · 2023-10-24 22:36 Mailcow works perfectly fine for me. Even helps you get DKIM/Spf and setup dmarc everything working fine, without dropping mail into spam folders. Your mileage may vary but it is very easy if you can follow simple instructions with great documentation. ---------------------------------------------------------------------- thekrautboy · 2023-10-24 22:40 I didnt say its impossible to selfhost email. ---------------------------------------------------------------------- Paper900 · 2023-10-24 22:49 So why are you FUD'ing without arguments? ---------------------------------------------------------------------- w3gamer · 2023-10-24 22:57 >The general consensus is that its not worth the headache to selfhost email. Ignore this. I have a selfhosted mailserver at home (running on a cheap dell mini pc for a year now). It will be a lot of work but it is worth it. IMO these are the most important things you need to setup: - AV, SpamAssassin - SPF, DKIM, and DMARC - Domain reputation (this will probably be the most difficult) The problem you'd be facing after all that is your emails will still be considered junk/spam by the big email providers (gmail, outlook, etc.), so until your domain has a very good reputation you may want to delegate your outbound emails to a service like Amazon SES. This should allow your emails to be delivered without issue. ---------------------------------------------------------------------- eattherichnow · 2023-10-24 22:58 > live in the US LOL 😅 ---------------------------------------------------------------------- xenophonf · 2023-10-24 23:13 I've self-hosted my email for over 25 years now and just finished migrating my ancient Postfix+Exchange setup to Mail-in-a-Box. I couldn't be happier with how well it worked, all things considered. I used good old ExMerge to dump mailboxes to PST files, and then I used Outlook plus CalDav Synchronizer to import everything. The only things that didn't transfer cleanly were calendars, but the important calendar items for things like birthdays were all recreated when I transferred the contacts over. ---------------------------------------------------------------------- Droophoria · 2023-10-24 23:14 I didn't say you said it's impossible to selfhost email. Now you have yourself a great day ok? ---------------------------------------------------------------------- thekrautboy · 2023-10-24 23:16 Then why are you recommending and explaining Mailcow to me? Tell OP about it. ---------------------------------------------------------------------- jippen · 2023-10-24 23:25 You certainly can do this, but email is one of the few things I recommend not self hosting. My experience working at a spam filtering company really taught me how bad this can be. Here's some of the reasons why I recommend against it: Not getting an important email delivered because it came from a residential IP range and that alone puts you on several anti spam lists. Not receiving an important email because some email admins put the blocklists on in both directions. Sudden email issues because your IP changed. And now you have to re apply for all the blacklist removals again. Internet/power goes offline at home, and some senders aren't configured to retry. Get hit with a joe job attack and get gigabytes per hour of spam permanently, with no real way to stop it. You may be sending and receiving too little email to actually remain in the good behavior cache for many spam filters. One overeager cronjob or broken script and now you are on even more blacklists. Misconfigure your server slightly and you are now a spam relay. Spammers scan the internet regularly for targets. You are not small enough to escape notice. In case of house fire, what is your recovery plan? Have you tested it? Can you send "I'm okay" or insurance docs around if this system is permanently offline? How many weeks do you end up with zero email? How about people who depend on you as their provider? ---------------------------------------------------------------------- armando0000 · 2023-10-24 23:34 Iredmail Poste.io Mailcow ---------------------------------------------------------------------- nefarious_bumpps · 2023-10-24 23:51 And it would be very hard, if not impossible, to blacklist all AWS IP's. ---------------------------------------------------------------------- luckymethod · 2023-10-25 00:00 Don't. ---------------------------------------------------------------------- nefarious_bumpps · 2023-10-25 00:20 >Also, because mailinabox uses (and only uses) the most up to date TLS versions Does this not still work:[https://discourse.mailinabox.email/t/how-to- re-enable-tls-1-0-in- miab/7545/8](https://discourse.mailinabox.email/t/how-to-re-enable- tls-1-0-in-miab/7545/8)? ---------------------------------------------------------------------- GWBrooks · 2023-10-25 00:52 Huh... never saw that. I'll try it. ---------------------------------------------------------------------- lmux · 2023-10-25 02:14 I take a mixed approach: emails to outside my domains go through a commercial email gateway, and within my domains are self hosted. ---------------------------------------------------------------------- homemediajunky · 2023-10-25 03:03 One you haven't listed is [grommunio](https://grommunio.com/). The community edition supports 5 users (unlimited groups, aliases, etc). Probably does more than you need though. ---------------------------------------------------------------------- LazyTech8315 · 2023-10-25 03:16 Check out "mail piler" for a local searchable email archive. I have mine slurping in emails from multiple sources, viewable from a web browser. I find the search index to be much better than commercial email services (yes, the biggest names). ---------------------------------------------------------------------- DTM450 · 2023-10-25 04:27 Not really, you can literally download a Public IP list from AWS of all their IPs and Prefixes ---------------------------------------------------------------------- Renkin42 · 2023-10-25 06:01 If AWS is on your radar, might I suggest [this guide](https://aws.amazon.com/blogs/opensource/fully-automated- deployment-of-an-open-source-mail-server-on-aws/) I came across recently? Notably it makes use of SES for the SMTP, which means that your outbound emails will appear to come from Amazon’s mail servers rather than yours. Outgoing mail can often be the trickiest part of self-hosted mail, as mail from “untrusted servers” will be extremely likely to get flagged as spam. ---------------------------------------------------------------------- rrrmmmrrrmmm · 2023-10-25 09:28 I used docker-mailserver before and find it less resource intense than MailCow but MailCow and Mailu might be easier to administer for your if you need to have a user GUI that's permanently running. However, [Stalwart Mail](https://stalw.art/) (also [on Reddit](https://www.reddit.com/r/stalwartlabs/)) is certainly the mailserver that I'd suggest to anyone nowadays since it's easier, modern tooling, efficient and secure. Having said that, I'd also suggest not hosting email by your own. I'm happily doing it but issues with reputation and SPAM and are thing. ---------------------------------------------------------------------- StanPlayZ804 · 2023-10-25 11:17 I also self host mailcow on my own servers without any issues at all. The setup was extremely easy, and the only “difficult” part was sending my ISPs engineering team an email for an rDNS change. That only took one email and after that I was up and running. ---------------------------------------------------------------------- sotvn · 2023-10-25 11:36 I setup iRedMail on a cheap VPS and it works great. I'm not sure about your import process but at least for the mail server it is flawless, and because it uses MySQL as the backend it is super customizable. ---------------------------------------------------------------------- BradSainty · 2023-10-25 11:49 Advice: don’t ---------------------------------------------------------------------- Todd1561 · 2023-10-25 12:04 I’ve used iRedMail hosted at home for the last year or so and love it. Even has ActiveSync integration for mobile devices. The key to selfhosting email IMO is to use a SMTP relay service to send outbound mail. I use SMTP2Go and it just works, even free. Everyone’s complaints about blacklists and reputation go away when you use a reliable relay. ---------------------------------------------------------------------- lucaprinaorg · 2023-10-25 12:45 iRedMail under FreeBSD jail, that's all you need to run at home and rock on... ---------------------------------------------------------------------- madumlao · 2023-10-25 14:19 the biggest problem with hosting email is that the main way of contacting everyone you need to contact when someone (your provider, client, client's network admin, partner, vendor, customer, etc) has broken your email service is also email. ---------------------------------------------------------------------- alexfornuto · 2023-10-25 14:59 After self-hosting for a few years, I found the perfect solution: *not* self-hosting. ---------------------------------------------------------------------- DoTheThingNow · 2023-10-25 15:18 This is the way... maybe search this sub and see how many times people ask and how many times people say "DON'T DO IT" ---------------------------------------------------------------------- rad2018 · 2023-10-25 15:37 Agreed. I use Promox with Mailcow/SOGo. Works beautifully. And people who think it's a 'one and done' are gravely mistaken. It's a constant monitor 'n tweak. Spam doesn't resolve itself... 😉 ---------------------------------------------------------------------- rad2018 · 2023-10-25 15:39 So...you'd consider Stalwart over Proxmox/Mailcow hybrid configuration? I see an awful lot of 'tweaking' needed by Stalwart. Though I am NOT saying that it's a bad app, its something to still consider... 😉 ---------------------------------------------------------------------- rad2018 · 2023-10-25 15:43 I don't trust anyone to host my email for me, esp. cloud service providers where your data could be ANY...WHERE in the World. I trust 'me, myself, and I' sandwiched behind 3-4 firewalls. I'm also using 'ciphermail' for sending/receiving encrypted emails, too for the more 'sensitive' material (nothing illegal; just proprietary projects and don't want Google sniffing around). It also helps that I 'own' (and I use that term very loosely) my IP addresses, so it kinda helps with reliability and veracity issues. ---------------------------------------------------------------------- Binou31 · 2023-10-25 19:07 Mail self hosting is horrible du to several technical cases, First, it's hard to keep a good reputation on the web and for the next is question about spam filtering. After that, there is probably needs an antivirus solution And I'm not mention several configurations on different place, storage, DNS, SSL, etc.. an manage it in the time My advice is you should not consider to self hosting mail. ---------------------------------------------------------------------- rrrmmmrrrmmm · 2023-10-25 20:13 These are two different things but yes: 1. I'd recommend any containerization over virtualisation because I'd get more performance for the actual applications since nothing will be lost for the virtualisation layer. 2. Yes, I definitely prefer Mailcow over Stalwart. There's no "tweaking" _needed_ for any of these but _both_ of them _should have_ proper configuration to have a _good_ working email server. This is not even limited to Mailcow and Stalwart though but true for _all_ email servers. Both, Mailcow and Stalwart, make the configuration easy and both are well documented. ---------------------------------------------------------------------- Mean_Interaction2374 · 2023-10-26 03:55 Personally I think poste.io is a great solution. It's fairly lightweight, easy to set up and has a great interface. I am surprised it's not mentioned more often. ---------------------------------------------------------------------- SilverFoxPurple · 2023-10-26 05:55 Thanks for this thread, I have exactly the same use-case, but I have not yet had the time to actually research too deep into it so I am unfortunately still relying on Google. My partial conclusions: \- I've been using the AnonAddy approach for 20 years now with my own domain, like many others have. You do not actually need a full suite for this, just setup your incoming email on your domain with a wildcard, choose a unique email address for everything you sign up for, and that is it. Sidenote: You'll be amazed at the confused faces you get when "Joe Plumbing Co" requests your email address and you reply ["joeplumbing@yourdomain.com](mailto:"joeplumbing@yourdomain.com)". \- For outgoing mail, just use SMTP2GO on the free tier, it works fine and I've never had delivery problems. Ignore everyone that talks about IP reputation making it impossible to self-host, while it is true, there are several suppliers with a free tier or a very low cost that take care of this for you. I use it nowadays with Thunderbird because for some reason I was unable to properly use custom aliases with the Google SMTP server. \- For incoming mail, you will probably need a better plan than self- hosting. Your server needs to be up 24/7 or you will end up losing email, so it is probably better to have a cloud-based incoming server that holds it and forwards to your server when it actually becomes available. I'm still investigating this part but it would seem that Cloudflare Mail Routing should work. I have not yet found what the best solution is to the self-hosted archival search problem, please share your findings! ---------------------------------------------------------------------- nefarious_bumpps · 2023-10-26 09:13 Getting the list of IP's isn't hard. Implementing it without breaking the sites/apps you need or want to use is a different story. ---------------------------------------------------------------------- radiogen · 2023-10-28 08:44 >Mailcow > >what about search through attachments with your webmail client?