this post was submitted on 21 Nov 2026
252 points (96.3% liked)

Selfhosted

64243 readers
752 users here now

A place to share alternatives to popular online services that can be self-hosted without giving up privacy or locking you into a service you don't control.

Rules:

Detailed Rules Post

  1. Be civil.

  2. No spam.

  3. Posts are to be related to self-hosting.

  4. Don't duplicate the full text of your blog or readme if you're providing a link.

  5. Submission headline should match the article title.

  6. No trolling.

  7. Promotion posts require active participation, with an account that is at least 30 days old. F/LOSS without a paywall has exceptions, with requirements. See the rules link for details. Tags [CBH] or [AIP] are required, see the links in Rule 8 for details.

  8. AI-related discussions and AI-involved promotional posts have additional requirements for tagging, as noted in Rule 7 and the AI & Promotional Post Expanded Rules post, and find example disclosures here.

Resources:

Any issues on the community? Report it using the report flag.

Questions? DM the mods!

founded 3 years ago
MODERATORS
 

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: https://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.

top 50 comments
sorted by: hot top controversial new old
[–] MuttMutt@lemmy.world 90 points 2 weeks ago (6 children)

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.

[–] danielquinn@lemmy.ca 24 points 2 weeks ago (1 children)

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?

[–] MuttMutt@lemmy.world 28 points 2 weeks ago (3 children)

Correct, a VPS or a Raspberry pi in a data center can be used. You would still need to install the software and configure it.

[–] carloshr@feddit.cl 14 points 2 weeks ago (3 children)

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.

load more comments (3 replies)
load more comments (2 replies)
[–] neidu4@piefed.social 18 points 2 weeks ago

Seconded. I used to selfhost email, and it's a pita. Doable, sure, but in my case I concluded that it just wasn't worth it.

[–] Wildmimic@anarchist.nexus 10 points 2 weeks ago (2 children)

If you want someone to blame look to the Spammers and Hackers of the world.

But don't forget the reason why all of this is necessary: email was created by hippies, and therefor any kind of security was really not on their minds when they built this stuff ;-)

[–] Spite_By_Design_LLC@lemmy.dbzer0.com 14 points 2 weeks ago (1 children)

Ah yes, the hippies at ARPANET

[–] Wildmimic@anarchist.nexus 16 points 2 weeks ago* (last edited 2 weeks ago) (3 children)

That was the network, but email itself is a very hippie thing.

https://en.wikipedia.org/wiki/Jon_Postel

I cite this article regarding his death: https://circleid.com/posts/in_memory_of_jon_postel

Jon loved the outdoors. I know he used to enjoy backpacking in the high Sierras around Yosemite. Bearded and sandaled, Jon was our resident hippie-patriarch at UCLA. He was a private person but fully capable of engaging photon torpedoes and going to battle stations in a good engineering argument. And he could be stubborn beyond all expectation. He could have outwaited the Sphinx in a staring contest, I think.

Edit: Here's a picture of email's hippie-in-chief:

image

Seems like he was a great guy, but security was not on his mind back then.

[–] MonkeMischief@lemmy.today 8 points 2 weeks ago

A bro named "Postel" helped develop Email standards. What a trip. :-D

load more comments (2 replies)
[–] Blue_Morpho@lemmy.world 10 points 2 weeks ago

Security isn't the issue. The problem is inherent to any system that lets someone communicate with you without your prior approval.

If physical mail cost nothing to deliver, junk mail would be a gigantic problem instead of a nuisance.

load more comments (3 replies)
[–] the_q@piefed.social 55 points 2 weeks ago (1 children)
[–] brackled@lemmy.world 25 points 2 weeks ago (2 children)

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.

[–] Reannlegge@lemmy.ca 15 points 2 weeks ago (3 children)

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.

load more comments (3 replies)
[–] Rentlar@lemmy.ca 7 points 2 weeks ago* (last edited 1 week ago)

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.

[–] kensand@sopuli.xyz 37 points 2 weeks ago* (last edited 2 weeks ago) (1 children)

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:

  1. Maintain the same IP for as long as possible - helps with reputation.
  2. 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.
  4. Make sure your provider will open port 25 and all the rest.
  5. Make sure your provider will set up reverse dns
  6. 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 https://mailu.io/ for my mail server as of late; no affiliation. Going on almost 10 years hosting now.

[–] a14o@feddit.org 19 points 2 weeks ago

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.
  • Do not bounce emails.
[–] hemmes@lemmy.world 23 points 2 weeks ago (5 children)

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)?

[–] korthrun@lemmy.sdf.org 11 points 2 weeks ago (3 children)

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.

load more comments (3 replies)
load more comments (4 replies)
[–] IsoKiero@sopuli.xyz 21 points 2 weeks ago

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!

[–] JRaccoon@discuss.tchncs.de 15 points 2 weeks ago* (last edited 2 weeks ago)

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.

[–] tremble5218@programming.dev 15 points 2 weeks ago

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 (https://github.com/awesome-selfhosted/awesome-selfhosted#communication---email---complete-solutions), specifically Mail-in-a-box or Docker-mailserver.

[–] smiletolerantly@awful.systems 15 points 1 week ago (1 children)

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.

[–] ssfckdt@lemmy.blahaj.zone 8 points 1 week ago (15 children)

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.

load more comments (15 replies)
[–] BuckFutter@timeyak.com 14 points 2 weeks ago (1 children)

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.

Postfix Virtual Hosting With LDAP Backend And With Dovecot As IMAP/POP3 Server On Ubuntu Bionic Beaver 18.04 LTS

[–] estebanlm@lemmy.ml 7 points 2 weeks ago

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 :)

[–] kuadhual@lemmy.world 13 points 1 week ago

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.

[–] ikidd@lemmy.dbzer0.com 11 points 1 week ago* (last edited 1 week ago) (1 children)

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.

load more comments (1 replies)
[–] Shimitar@downonthestreet.eu 10 points 1 week ago

Absolutely go ahead!

My recommendation would be to do so on a VPS, don't do it with your home IP address.

Today there are some all in one solutions, but I prefer the old hands on at all levels approach.

This is my personal experience: https://wiki.gardiol.org/4-e-mail-hosting (no ads, no monetization, no AI).

I installed and setup postfix and dovecot and dkim dmark, the works.

One more advice: DNS records are key, do not skip them, everything depend on proper DNS setup in the email world.

[–] Anafabula@discuss.tchncs.de 10 points 2 weeks ago

If you really want to do that, https://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.

[–] pHr34kY@lemmy.world 10 points 2 weeks ago* (last edited 2 weeks ago)

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.

[–] anzo@programming.dev 9 points 2 weeks ago

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 🤯

[–] hperrin@lemmy.ca 9 points 2 weeks ago

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?

[–] Onomatopoeia@lemmy.cafe 9 points 2 weeks ago

As others have said, this isn't something you want to do.

It's surprisingly a LOT harder than people think.

I pay for mailbox.org because I need more aliases, but the free version is really good.

I NEVER get spam there.

[–] grepe@lemmy.world 9 points 1 week ago

good luck.

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.

[–] pez34@lemmy.world 9 points 1 week ago

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. https://getrealip.net/ is one of them, see their guide for self-hosting email here: https://getrealip.net/guides/self-host-email-server/

[–] BananaTrifleViolin@lemmy.world 9 points 2 weeks ago

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.

[–] surewhynotlem@lemmy.world 9 points 2 weeks ago

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.

[–] Blackmist@feddit.uk 9 points 1 week ago

Thoughts and prayers, buddy.

Email is now a cartel.

[–] Badabinski@kbin.earth 8 points 2 weeks ago (3 children)

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.

load more comments (3 replies)
[–] autonomous@lemmy.world 7 points 2 weeks ago

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.

[–] erev@lemmy.world 7 points 1 week ago

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!


^1.^ https://workaround.org/

[–] anon02947382020@lemmy.today 7 points 2 weeks ago (1 children)

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!

load more comments (1 replies)
[–] Reven@lemmy.world 7 points 1 week ago

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.

So buckle up and start planing.

load more comments
view more: next ›