Self Hosted E-mail server

I have some applications on my home lab that can send out E-mail notifications and I would like to utilize this. I have my own domain and used to use Sendgrid. However, my Sendgrid account got terminated for “inactivity”. I would like a self hosted option in place of it.

Doing a quick google search returned a paralyzing amount of info with everyone claiming their service to be the best.

I am looking for a self hosted E-mail service where apps can use it as a SMTP relay, as well as the ability for me to connect an email client and use it as a normal inbox if I decide to do so one day.
Extra nice to haves that I would appreciate: Easy for beginners (in terms of setting up an email server), Cross platform, Available on TrueNas Scale App Store, No external DB requirements

it is REALLY difficult to have a self hosted email server now. rather than me rant about it, here is a professional who has also ranted about it.

i will add that i have even seen small business on real ‘business class’ ‘unfiltered’ internet plans also have issues. not to mention the multitude of other problems an individual will face doing this.

even just a local relay like Nextcloud with email can sometimes cause (have?) issues.

I am also a hosting professional and I disagree with this.

What you can’t do is send mass commercial email without getting banhammered into oblivion.

I feel like most people who complain about not being able to self-host are trying to promote their brand, blog, product, et cetera, get reported as spam, and then get blacklisted.

Running your own personal email server with non-commercial, human-like email is absolutely doable.

VPS + Mail In A Box = Cheap, reliable self-hosted email.

I have had exactly zero deliverability issues running my own mail server, and routinely deliver to Microsoft, Google, and ISPs.

As long as you’re not running a public internet facing email service, you could install postfix, tune the default config a little, and it’ll work.

Not sure, whats the best way to run it on TrueNAS.

1 Like

a lot of ISPs block SMTP traffic and the ports associated with it. (even on small ‘business’ plans)

most people have a hard time with DNS in basic form, adding mail records causes migraines.

ONE accidental click on something that causes a rush of relay crap email and spam to ANY major email provided can have you domain blacklisted.

i am all for self hosted. email was not worth the effort.

1 Like

I’m planning to run it on my home server but whatever. My main concern with mail in a box is that its github doesn’t seem as active with the last commit being a few months ago.

Its github looks… a bit daunting. Can you provide some more modern resources on it so I can read up a bit?

My ISP doesn’t block anything even on residential plans.

Gotta start from somewhere

Can you not just set up postfix or exim4 and relay me@localhost messages to your gmail (or whatever)?

As am I, and I also disagree.

My self-hosted mail setup for the past 15 years has been Postfix on Debian with Dovecot for IMAP, and RoundCube for webmail.

The biggest mistake that people that self host make is, not understanding how SMTP truly works, and how DNS records, including your reverse PTR records are important. Setting up not just SPF records, but also DKIM signing and DMARC records.

Set this up correctly, throw graylisting on the server, and you got yourself a solution that rejects 99.9% of SPAM before it even reaches your server, no need for complex and heavy tools to scan for spam.

Never had this happen once, both for my personal hosting and corporate hosting for clients. And your domain doesn’t get blacklisted, your SMTP server does by IP address. If you’re desperate after such a mistake, it’s not hard to move to a new IP if required.

As for turn-key solutions like mail in a box, I do not recommend them if you are intent on learning. You should also know that even if you do use a solution like this, there are external things to configure even still that if you do not, will cause your email to be rejected (DKIM/SPF, RDNS records).

1 Like

There’s also people who complain about postfix being slow and easily ddosed, … I mean it’s postfix - it’s not Gmail. If you want to run your own millions of email per second service, write your own SMTP server and stick mail into Kafka or Ceph or something that unlike postfix is intended to perform.

The other that you may have heard is that you can’t keep a decade’s worth / terabyte of email in your inbox if you self host and everything just crashes. … that’s also kind of true. You probably don’t want to keep more than a few gigs if email.

I joke that it’s a conspiracy by lawyers to make you delete mail after a while because it crashes their blackberries.


Postfix documentation problem is that everyone complains about email being hard, and immediately proceeds to fix the problem by writing their own documentation on how to adapt postfix for everyone else’s use case which… newsflash… isn’t the same use case. People have different needs.

Have a glance over guides of major distros:

… but, what you really want is somewhere here:

… or inside comments of the config files and inside log messages of various postfix components, as is usual for any server software. Logging ftw.


By default, postfix receives email over SMTP, or gets email injected by local mail/sendmail software, does its “processing” and gets your email as far as a “maildir”, which is a directory, and every email is just a text file on a filesystem.

During “processing” it can rewrite mail and forward it to Gmail, it can trigger AI ML spam detection, but ignore all that for a sec. People who self-host email, generally just host maildirs, and run smtp.

Dovecot is a second part of that system, that will let you access your maildir using IMAP, so your Android email app, or Apple Mail app or Thunderbird or whatever, can connect and sync the contents of the maildir into the local UI storage.

RoundCube that @gnif and others are mentioning is a web UI on top of IMAP + SMTP, … lots of folks I know use Gmail as their UI and search engine for their email. I’m not sure how much you need that.

1 Like