Actually it's fine until it's not. Then your email doesn't work and you could be missing out on important communications. And then you're scrambling to figure out how the spammers managed to exploit your setup this time. And you have to learn a tonne of crap in order to manage it... and the text files! Configuration... configuration everywhere. Obscure configuration. Configuration that has real consequences and causes spooky action at a distance. Configuration that will soon be exploited in strange ways.
I was so frustrated the last time my mail server went down that I started writing an SMTP protocol handler in Haskell with the intent of writing a MTA with the goal of minimizing configuration and being secure and resistant to attacks by default. So that hopefully more people can run their own infrastructure without prematurely aging. I dunno how useful it will be to others but at least it will keep my gray hairs at bay, I hope, when it's ready for use.
Until then though we need more guides like this for us poor souls who do go down this route. There are way too many out-dated guides awash in the sea of information.
" ... writing a MTA with the goal of minimizing configuration and being secure and resistant to attacks by default. "
As a 20+ year UNIX sysadmin and fellow owner of my own email infrastructure for 18 of those, I am surprised to read this and am not even sure what you are talking about.
Can you explain what you mean by attacks and exploits from spammers ?
Other than accidentally running as a relay or actually having a remote exploit in your server(s), what are the attacks that you have in mind ?
"Configuration that will soon be exploited in strange ways."
Again, am genuinely interested in an explanation ... other than running as a relay, and maybe handling backscatter (but that's not really config, it's just a blacklist) what are you referring to ?
Mail server setup for the uninitiated does look a little daunting, especially if you're more accustomed to "all-in-one"-ish software. If you want to do this, I recommend starting with making sure you have a clear mental model of mail server architecture, especially where it touches other things (DNS, DKIM, spam filters, local delivery, probably IMAP, maybe LDAP, maybe databases, etc.) Without a clear idea of the dataflow and reasons for different decision-points, you're going to have a very bad time troubleshooting things.
 SBCGlobal.net has been rejecting me for over a decade despite there being zero spam ever having been emitted by my domain. Eh, my userbase communicates with exactly one SBC user; ATT can bite me.
But other than that, running my own mail server hasn't been much of an issue. Set up sendmail, use public blacklists for spam control, and it pretty much runs without any intervention.
I'm thinking of solving it by blacklisting outlook.com domain, so that senders at least know that I can't respond to them. I can put a message in the error response, that will be reliably relayed to the sender by the sending system.
Google's slightly better. Recently I did an experiment and created a few gmail accounts and sent some riduculously spammy messages full of typical keywords in between those gmail accounts, and they were all successfully delivered. Always.
Then I sent e-mail from new gmail account to my email server and simply responded and it went to spam. It's ridiculous that such a simple heuristic like someone responding to a message gmail user sends doesn't get the message through spam filters, even though the system can clearly determine taht the message is legit based on many variables (References field referencing message-id of the original message (noone else than the recipient should know this), reply being from a correct source (DKIM/SPF), message having normal looking business content, etc.).
There's way too heavy a weight on sending server IP range reputation.
But gmail was not. Even as a business user with support.
Gmail rejects me as an ugly spammer at the gate when using IPv6 but not when using IPv4.
My IP addresses are not listed in any public blacklists.
And the Borg hivemind is not able to tell me why. Gmail support is friendly but have no knowledge of their filter nor an escalation path.
The amusing part is they reject me as a bulk sender. But when I register into their bulk mailer program my volume is too low.
This is with strict SPF, DKIM, DMARC and registered with dnswl.org.
I had a problem with ipv6 myself with gmail, but the problem was that I just didn't have ipv6 fully set up on my server, so either SPF or reverse DNS wasn't working or something like that. I think I just configured sendmail to only use ipv4 and that solved the gmail issue.
This was my experience, too. I took this advice  configuring postfix and Gmail started to accept my emails.
The problem I have is that it's a pain in the ass to setup correctly and when things do go wrong it's really hard to figure out what's going on.
> Can you explain what you mean by attacks and exploits from spammers?
I haven't encountered a remote exploit (yet) but yes: accidentally running an open relay, backscattering, etc. You also have to worry about the system security of the box you're running it all on but let's treat that as a separate concern.
I'd been running my setup for years and as recently as August of last year I was dealing with an outage of my email server. I must've missed something somewhere because someone had figured it out and started using my server as a relay. It took me a few days to figure it out and I'm still not sure what the problem was or how I fixed it. Though my server stopped bouncing emails and started forwarding things again so... win?
As I was fixing this issue, not the first time, it occurred to me that it was just criminally easy to not know if your system is being exploited as a relay or not. There are a bunch of different configuration files in all different formats and guides that require working through dozens of steps. It's way too easy to get something wrong.
For someone like me who works at deploying software running on hundreds of nodes it seems manageable but I don't think it's ready for my cousin who's good with computers.
That's where the idea for a secure-by-default MTA that couldn't possibly be configured to be an open relay came from. Minimize the configuration so it was hard to get wrong even at the expense of flexibility.
I dunno, maybe it's not a great idea. But it's fun to hack on in the evenings when I've got nothing better to do and hopefully I'll have a fewer text files to manage in the future.
You're close to describing the motivation behind Postfix. Between the design and the documentation, Postfix is hard to screw up, from a security perspective. And it is really easy to configure, at least in contrast to What Came Before - believe me, if you think this is complex, buy a crusty sysadmin a beer sometime and mention 'sendmail.cf'.
The problem here is that almost all mail servers need to selectively relay, and I don't see how the server is going to guess appropriate policy. For instance, trusted IP ranges (mynetworks, in Postfix). I suppose you could demand authentication unconditionally but that tends to break down when not all of your senders are made of meat. Maybe that's acceptable to you, but it won't be for many.
In my other comment in this thread, I recommended gaining an clear understanding the architecture if you're going to do this. That includes things like knowing what (for postfix) mynetworks does - you can get mad at software for not intuiting local policy preferences, but I've never found that to get me very far.
 Getting better, but I still depend on a fair bit of software and hardware that doesn't speak SMTP auth.
I know my emails aren't being farmed from the NSA (at least from my side). I know Google isn't scanning all my emails to sell me garbage. I know it won't be shut down because of some errant algorithm. I have a really short email address. I can setup family and friends easily. I can send newsletters without having to deal with someone else's policies (on my side anyway). I love it.
Spammers WILL know how to search your mx records for things like mailbagging servers and try to exploit them to bypass your security, just don't do it - the sending party will retry.
Checking white-lists can take a while and some SMTP servers will give up if they're stuck for over a second, sometimes less (eg when your server checks the spam-lists). Some SMTP servers or DNS server (cought Google caugh) will not try secondary though, so if you can afford it - have just one powerful front server with good uptime and network, or load balance / proxy to internal farm.
Running since 1998, haven't been on any blocklists so far.
This is absolutely not true.
I will make that claim even more specific:
Less than 5% of the email:password combinations in the linkedin dump work today as email logins. “most” suggests a far higher success rate.
Also, with regard to your claim to have data about which passwords work. You should be aware that accessing someone's account with their username:password without permission (even a breached password) is likely illegal in the United States under the CFAA.
Most users that reuse passwords statistically did not rotate their passwords across all websites because most users that reuse passwords statistically do not rotate their passwords.
We aren't talking about the overall Linkedin userbase, just that specific subset that reuses passwords for secure services.
I have absolutely no idea what you mean.
>most users are probably still using the same password for their email as they used for LinkedIn in 2012.
Suggests that more than 50% of all users currently use their 2012 linkedin password as their email password, which is absolutely not true.
>Then your email doesn't work and you could be missing out on important communications
Pretty much every E-mail server will retry sending your E-mail for a long time (like 2 days is default on postfix). Once your mail server comes back up all of your E-mail you missed during the downtime will come in slowly as messages are retried
>you're scrambling to figure out how the spammers managed to exploit your setup this time
Any tutorial should point you in the right direction restricting open relay on your mail server, just basically requiring authentication to send E-mail outside of your server.
>I started writing an SMTP protocol handler in Haskell
Do you have any link to your progress? Postfix's configuration definitely shows age, but all of the options do important things that you could actually want to change. It seems other MTAs either have just as complicated configuration (to do the same things), or have stunted functionality.
>being secure and resistant to attacks by default
I agree about sensible and more secure defaults in configuration. But the application security of postfix and dovecot are both pretty robust. Considering they are 19 and 15 years old, both applications have seen several developer-lifetimes of effort.
>we need more guides like this for us poor souls who do go down this route
I agree, though mediocre howtoforge tutorials seem to have worked fine for this poor soul.
For larger scale e-mail sending I built my own MTA (https://github.com/zone-eu/zone-mta), our main instance sends about 750k emails a day (mostly normal ISP traffic, maybe 25% marketing emails) and its most valuable feature is juggling with IP addresses and blacklist detection, so if some mailbox gets hacked, starts sending out spam and the IP ends up in Spamhaus et al then this IP is removed from the list for other users automatically. Has saved us a ton of time.
I'm not going to run like per-user stats but I know historically there's been about 11kb per E-mail on average, so that's about 90 million mails stored. The MTA itself sends and receives a bit over 20 million E-mails annually, so the extra from that is probably from the mailing list I run on the same server (where each message only counts as 1 for statistical purposes)
How I prevent outgoing abuse is a black box, but I do it well enough that mail from my server almost never ends up in spam. But given that it's a free service I definitely don't have the budget to warm up and dynamically scatter mail across IP space to maximize deliverability. Cool technique, though!
It sucks ass when your mail does not get through as GMail/Hotmail rejects a connection from the IP address your cloud company allocated for you, in spite of DKIM etc. Or they decide to mark your mail is "suspicious" and it goes into the recipient's Spam folder. Fighting these huge hosting companies is impossible as they don't want to talk to you.
Also constant tweaking Spamassassin is not fun. My setup worked well for for the first four years but then started letting more crafty junk through... So, I had to compromise by moving the mail to Fastmail.
God, yes. Gmail, in particular, really enjoyed just dropping connections from my IPv6 addresses every few months. Sometimes it would return an error, something obtuse and wrong like maybe, "your forward and reverse DNS records do not match" even though they absolutely did and hadn't changed in years.
Outlook/Hotmail was far better and would always return a sane, yet sometimes inscrutable, error that bore some resemblance to reality. It still took them a week to get me off the hit list that I got dropped on for no discernible reason.
> Or they decide to mark your mail is "suspicious" and it goes into the recipient's Spam folder.
Gmail was the ABSOLUTE FUCKING WORST about this. My spouse's e-mail to Etsy customers who used Gmail--not spam, not newsletters, person-to-person e-mails INITIATED BY THE CUSTOMER--would work for the first couple of e-mails in a thread and then start going into spam. Or, even more fun, friends with whom either of us had e-mailed would send us a mail and then we'd reply and nope, into spam.
Gmail would do this for WEEKS and no amount of poking or begging or pleading would make it stop. And then it spontaneously would. So maybe the begging did work but was just delayed. I dunno. I tried signing up for Gmail's "Postmaster Tools" but no data was ever reported because "your mail volume is too low."
The ultimate ignominy? The final humiliation that sent me to Fastmail? I finally, through a couple of professional contacts, got to actually e-mail (via Gmail, of course, because they were blocking my personal domain again) with a real, live Gmail SMTP admin to ask why my latest round of e-mails were going into the bit bucket. Know what he said, even though my domain has been hosted on a server in the same colo facility with the same IP addresses for a decade? Something along the lines of "your domain reputation is coming back as too new."
Ladies and gentlemen, I give you whois:
google.com - Creation Date: 1997-09-15T04:00:00Z
mypersonaldomain-notreallythisvalue.org - Creation Date: 1997-03-10T05:00:00Z
Worst of all, the mail does not always bounce... and when it does, this is no one to email and ask. What are mail admins supposed to do?
That is fucking shameful indeed. Domains with tiny volume need postmaster tools the most…
But it seems like having a little conversation from your domain with a gmail address helps. Just send a mail to your google account, click not spam, reply, do a couple more back and forth replies.
Did you follow up on that crap and asked what the fuck could possibly be going on with this nonsense? (More politely than I just did of course.)
I did your exact follow up - politely and persistent!!
It was a dead-end. They had no idea - and worse - no escalation path to the SMTP team.
You can have a domain registered with Gmail or Rackspace Mail or whatever, and use the SMTP credentials they give you for outbound, while keeping MX records point to your own SMTP for inbound. Or you can let them process the inbound as well (fighting spam for you) and you just forward everything (or sweep via IMAP) and put it into your own Dovecot.
This way you control what's important to you (email storage/backups/etc) but outsource delivery and spam filtering.
I tried this with Mailgun, and it caused my mail to be marked as spam.
That's only if your broker and doctor are not using Gmail or G Suite, otherwise your email (with them) is likely to be read by Alphabet regardless of your server setup.
The biggest pain is no longer having a static IP or reverse DNS (thanks Sonic!). Having reverse DNS setup and an IP address that doesn't map to a pool of dynamic IPs are the big things that will keep you off of spam lists.
Coming from sendmail I think postfix and dovecot have been a breath of fresh air. The defaults generally just work. Getting inbound (so spamassassin can check) and outbound dkim to work were the trickiest part. Aside from regular OS updates it's largely hands off.
So you call it easy to configure together 7 different systems just to get a working mail server?
Yes, with the qualification that I brain farted on cyrus (not using that for mail) and you can just as easily skip the two dkim packages (which were a bit tedious to figure out).
Postfix works out of the box. Diffing the stock main.cf with mine the differences are: new additions that never made it into my main.cf, a few lines to enforce stronger TLS ciphers (optional), a manual blacklist (optional), virtual domain stuff (also optional), milter lines for dkim and spf (optional), a line to deliver to procmail instead of directly to a mailbox (optional), and a line to enable mail relay access to authenticated users (also optional). You could install postfix and have a good experience out of the box.
Dovecot: a line to enable verbose process names (optional), a stanza to enable the SASL backend (optional), a line to specify which keys to use for TLS (mandatory), a few lines to up per-user limits (optional). Setting up SSL is going to be the hardest part, and even that shouldn't be too bad.
Procmail: A couple lines to pipe everything to spamassassin and deliver to a mailbox or a spam folder. This may be considered tricky by some but procmail is ancient and, in my experience, examples abound.
Spamassassin: No changes. In fact I think I've ripped out most of my custom config except for some whitelist stuff.
Four packages and you'll have a working SMTP and IMAP server. No, I don't think that's difficult. Wrangling an OpenLDAP install, sure that's difficult. This? No. Scaling it out to hundreds or thousands of users is trickier, but not something the typical home user would need to bother with.
For everything above there's actually quite good documentation. What's difficult is figuring out which packages to install in the first place and deviating from the stock configurations for the little extras you may want, but even then the big challenge is in taking the time to read the documentation and figuring out which features you want. Maintenance is trivial, although I probably should update my postfix config to get it in line with the current config syntax.
Dovecot uses PAM for authentication, and so any user with an account can log in and access their own mailbox and send mail out. The biggest downside is that because I'm deviating from the default FreeBSD configuration for postfix I'm on my own in terms of updates.
I should also clarify the above statement about moving it all into a jail -- I mean a jail managed by (in this case) ansible. Yes, if you just slap something together it will be brittle no matter what stack you choose. Ansible + Jenkins + Jails make it much easier to manage changes.
Edit: Oh yeah, and I've thrown procmail in there for good measure.
But I've been self-hosting mail services for over a decade at this point. It's seen a variety of permutations including some with Sendmail, some with postgres backed lookup tables for virtual hosting, and so-on.
If you can't run Postfix, run Exim in a container.
Configuration is one file, very simple. It won't do everything a sendmail does, but it's never had me pulling my hair out.
Configurations were incredibly unfriendly and tedious. Despite all anti-spam measures, Microsoft was blocking their IP according to some private spam blacklists. Then they couldn't send emails to some ancient government server in Guatemala because of encoding incompatibilities.
I ended up moving them to the free MailGun plan. It took me 2 hours instead of 2 days.
What do I do?
Get a nice VPS from a company like GoDaddy. Setup whatever domains you need. Setup as many email accounts as needed. And off you go. No problem. I don't even have to think about email.
I thought about rolling my own on one of our Linode servers but every time I compare the no-brainer of doing the above to what it would take to run this ourselves on Linodes I can't justify the pain and aggravation.
What I don't like about the Gmail approach (other than it is Gmail and I do not trust Google to not shut down all of our accounts for some stupid reason) is the cost. I can spend a few bucks a month on a VPS and have a hundred email addresses. The same on Gmail would cost significantly more and you would be under their irrational thumb.
A few years ago I looked into running Zimbra on Linode. Back then it was so resource hungry it just didn't make any sense. I wonder if it has gotten any better over time? I really like the concept.
1. Custom MTA that handles incoming SMTP.
2. SpamAssassin that is called by the above MTA which flags email as spam/not-spam.
3. Custom MTA forwards not-spam to the users inbox.
4. Custom MTA forwards SPAM to postmaster (this bit needs significant re-working)
5. Main Mailserver is Microsoft Exchange run On-Premises.
6. All Mail clients are Outlook 2016, or Android Phones.
The reason I had to write my own MTA was so that I could leverage a 3rd party anti-spam solution, as Exchange doesn't come with one, and add-ons for Exchange are quite expensive.
Running your own mailserver is a complete nightmare. If I knew it would end up this complex 20+ years on, I'd have never done it in the first place.
Of course I still have to worry about attacks at my domain provider level, but at least it removes one weak point. I'm waiting for the day that someone pretended to be me calls me to get me to reset my mail account password.
All the things that make running your own server hard are software problems, the protocol itself lends itself very well to running your own. We just need someone to build the [Caddy](https://caddyserver.com/) of mail servers. You have the right idea with your Haskell server, though I think in this day a Go project might be more successful.
I typically don't recommend someone running their own mail server, but if they do, I wish there'd be a good one they can use, and that one would definitely be a Caddy plugin.
Edit: it's been so long that i forgot it was in fact postfix.
This for me is the deal breaker. I say this as a sysadmin.
It's all well and good running a single server but if that shits the bed then you have to deal with it immediately.
So to run something that doesn't require 24/7 support I now have to run a cluster of servers.
I'll also need something to manage those servers like salt/ansible/puppet
I also need to deal with being my IP blacklisted because of a previous owner, or just entire domains now delivering my email because they don't like the fact i'm not using $email provider
Then there is spam filtering and the constant battle that is.
Or I could just pay someone a couple of bucks a month to worry about all that shit and not worry about it.
It's totally up to you how you prioritise getting a server back up again, and frankly if the message can't handle at least a few hours delay then email probably isn't the right medium for it.
This may have been the case in the mid-90s, but it is certainly not the case today. I frequently receive emails that require immediate attention, whether from my employer, my bank, or any number of other notifications. Normal email users expect emails to be delivered in seconds, not hours.
Iirc, its even in the spec
their expectations are unreasonable. gmail, etc don't even manage that much of the time, let alone guarantee it.
When email isn't nearly instantaneous, it's definitely upsetting to users and a violation of the norm. Email is only not instantaneous in well-managed systems when one of the parties is experiencing an operational problem of some kind.
There are exceptions to this, such as large scale marketing systems that deliberately send at a slow rate to avoid overwhelming recipients. Once deciding to actually send a message, though -- if not rate-limited by the receiver -- messages tend to arrive in the inbox in moments.
Email isn't that complicated of a protocol, when you get down to the mechanics of email delivery. Loading a web page is orders of magnitude more complicated than sending an email; there's no reason why sending an email would need to take longer.
Sadly, I haven't figured out a proper fully-redundant solution. Syncing mailboxes with e.g. Syncthing is way too fragile. Recently, I wanted to experiment with DBMail + CockroachDB cluster but haven't yet found time for that.
Never found any MRA that uses document-oriented database like RethinkDB; and GlusterFS is way too sensitive to high latencies - so DBMail+CRDB looks like the only readily accessible option sans of trying more "raw" programmable solutions like Salmon or Haraka and writing own storage backend.
Haven't seen this project before - and I've tried to search for mail servers using document-oriented DBs, although not sure if I've searched specifically for MongoDB. Will definitely take a look.
(But maybe I should review and simplify my mailbox/account structure... It grew quite messy at the moment.)
keep your DNS up always - so have a backup if this is running DNS - many mailing list programs and other things will drop a mail immediately if the destination cant be resolved..
It's really more of a second job.
But it's ever so much fun once you have a decent grasp on all these things
If the server falls over during the night, then meh... I'll probably fix it reasonably quickly if I'm not on a beach somewhere, and the sending server is supposed to try again anyway.
That's the number one reason I would like to run my own server. (And, no, the Gmail trick of adding "+foo" to the username doesn't satisfy me because spammers know this trick and can strip it.)
Quickly add a new forwarder and feed the service that email address instead of my normal address. When they turn out to be spammy, the forwarder gets removed.
What ESP do you recommend for unlimited (or large numbers of) aliases indistinguishable from individual email addresses (such as email@example.com firstname.lastname@example.org but not email@example.com firstname.lastname@example.org)?
Edit: fastmail's standard $50/yr plan offers 600 aliases. This might be good enough. I've created online accounts at 371 different services over the last 20 years.
Well, that depends on your needs. SMTP will keep retrying, so you won't lose any emails, you just might not be able to access them immediately. For my personal email, this is perfectly OK. Not that it ever happened, in my six years of running Exim + Dovecot, but that may have just been luck.
If you're running this in the cloud and properly automated everything, and its not a billing issue, responding and fixing things could be as simple as a few hours.
If you're running your own physical machine, repair times for hardware issues can be days.
If you're on vacation for a week or longer, and are making a concerted effort to step away from technology and lines of communication, or worse hit by a small bus and in the hospital for any length of time, you may not be aware of issues for some time.
At least if the the mail get's bounced after a few hours only, they get some sort of feedback, instead of being left wondering.
Postfix default is 2d, Exim 3d, and sendmail 5d, last I knew.
Off the top of my head, DKIM and SPF are somewhat new, using TLS for server-to-server communication is somewhat new and not fully deployed, etc. Mail server operators need to keep track of new developments and update their software and infrastructure to account for them.
There is no possible way that the current state of email is how it will be forever.
One recent thing is MTA STS but the progress is slow on this front (from my POV).
Meanwhile, there's ARC which is still in early stages of deployment, and hopes to fix the indirect mailflow problems of DKIM.
(and of course there's JMAP on the client side, which is super exciting for those of us working on it)
I'm disappointed in the mailing lists software and configuration "in the wild". Refusing to just change From address and put the original From into Reply To and breaking DMARC (that I've seen some operators just claim "is badly designed") is a very sad state of the world.
I've read JMAP spec but was not pleased with the RPC style design. I've seen "why isn't it REST" and the FAQ says REST is not mobile friendly. Still, reading all these Foo/get methods looks bad to my eyes (sorry, personal preference) an I don't see how it could improve caching (as the FAQ claims). I like the idea of replacing IMAP with something modern though.
It would be quite easy to write a REST mapping for people who like more chatty protocols of course.
I'm not a giant fan of Foo/get either - it's a very recent change from the previous getFoos|setFoos|getFooUpdates naming, and there are pros and cons of the change. I try not to interfere too much with stylistic details like that though.
Are there intentions to standardize JMAP under IETF?
We've been working inside the IETF on JMAP since Chicago (IETF98) in March last year.
Has links to the latest revisions of the drafts - and to the github repo where issues are being tracked.
My two most recent uptimes for my personal FreeBSD mail+web server were each over 1200 days.
My current months sent-mail folder stretched back for years - which is to say, my (al)pine process itself was 3+ years old.
No, you don't need a cluster of servers for your personal mail server.
> "I've never personally experienced a BSOD in Windows ME, so obviously it's incredibly stable. Those other people are just doing something wrong."
I used to have crashes all the time. Then one day I got the bright idea to actually read and understand the error code when the computer crashed. I did a few web searches to demystify the error code and its cause, and ripped out the software firewall I was running. And that was the end of my bluescreen troubles.
Now, if you want to argue about poorly designed tools and environments that make it all too easy to do the wrong thing, then I think that would be a valid and productive argument.
If it's just for your own use, no you don't. If a mail server is down, other mail servers trying to send mail to it will re-try for some time.
Just this week I was remotely logged in and screwed the iptables making the machine catatonic to the outside world. Came home in the evening and didn't even bother fixing it until after dinner and various other activities. Like, "oh yeah, before I sleep, I should fix that mail server ...".
Yes, servers are supposed to resend when they can't connect, but in practice for those periods where the backup MX was down, I'd still lose some messages I know I should have received.
Reliability and delivery consistency is more valuable then pretending your personal email server actually protects you from dragnet surveillance (in my opinion). The truth is every other smtp server you communicate with could be compromised, and if what you're sending is that sensitive, encrypt it at rest, not just in transmission.
I've been running my own mail server with https://mailinabox.email for ~2 years and can heartily recommend it.
Still, even with that there are gotchas if you want to be able to send messages from your server to Google et al, eg. reverse-DNS-records, DKIM, SPF.
Not for the pressed-for-time.
The integration with Let's Encrypt and a relatively smooth upgrade process has made it one of the more enjoyable services I manage. I would highly recommend it.
I also have no trouble sending email to Gmail users after carefully following all the steps in the manual! The only sticky point I had was that it required fancy DNS records that Namecheap doesn't support -- I think if I were doing it all over again I'd transfer domains over to a better nameserver.
Can't configure post-install? At all? This seems like it would be a showstopper for some.
I think what I'm trying to say is that it's not harder than it used to be (though some problems, like spam and security requirements for safety, have gotten worse in absolute terms). With modern tools and packaging on modern Linux distributions, you can be up and running pretty quickly. My company ships a turn-key solution as part of Virtualmin, but you can build something similar without that in an afternoon or two if you're reasonably Linux-savvy and have some notion of how all the pieces fit together (maybe a couple extra afternoons if you don't know the basics; DKIM and SPF can be tricky, since you also have to know or learn you some DNS).
It's harder than a web server or DNS server, but not something you should flee in terror from. Admittedly, it's gotten cheaper in recent years to outsource it...and with microservice-based architectures, maybe it makes more sense to have some other API than SMTP (though SMTP is very easy to use from every language I've ever worked in). But, there are problems and complexities with outsourcing, as well.
Have I invested enough energy? Apparently not. But I'm over the weekend-sized amount by a multipler bigger than three.
It would be great if someone wrote a program handling all of this that could be deployed as a single binary with secure defaults and limited configurability, but I don't see that happening any time soon. Email providers are good enough for almost everyone and the people who are good enough programmers to make sense of all the different protocols they'll have to deal with and get everything to interoperate nicely probably have other things to work on that people will actually pay for.
Edit: That said, this guide does look like a great resource for someone who is interested in doing this. It's interesting to learn how email works and if I had this guide when I started out I'd have saved a ton of time.
I've never regretted running my own server, nor have I ever contemplated moving to a hosted solution. Spam is not a problem either, Spamassassin in combination with a greylist make for a nearly spam-free experience. The whole setup has been migrated from the original Pentium-66 via an aBit-BP6 (SMP for the masses , retired in 2009) to the current Intel SS-4200 (upgraded to a dual-core Pentium but still limited to 2GB). In practice a Raspberry Pi would be enough to run a viable mail server so even this rather anaemic setup does its job without breaking a sweat.
The whole setup consists of Debian (Sid) running Exim through a smarthost, feeding through Spamassassin + greylistd into Dovecot. Apart from some auto-manual intervention to cope with Microsoft/Google/... not coping with the greylisting and thus needing whitelisting it more or less just works. In other words, just go ahead and run your own server.
My wife won't let me have a neckbeard though.
Total time spent on the mail infrastructure over these 22 years is negligible, probably ~8 hours per year.
I've also always been on Postfix, which has always been way more secure than sendmail ever was at the time. And Postfix is also much easier to configure for the basic case of "send/receive email for a personal domain".
How to run your own mail server (for experts): Don't.
I say this as someone who has run my own mail server for 20+ years.
Now, if you absolutely have to get off Google, and the other available hosted options don't work for you, then this article looks like a good start. I'd add roundcube for web access and letsencrypt for SSL.
One thing you'll never really get, in my experience, is good spam handling. The big providers just have so much more data to work with to prevent spam.
I've found the exact opposite. Big providers have to run more lenient rules than I'm willing to use. I can use SORBS and Spamhaus to bounce mail. Sure, both SORBS and SH suggest never ever doing this, but when you self-host you can check your logs, and over the course of a few years I've never had a false positive.
Now that I'm reliant on my ISP for inbound mail I don't have that low pass filter and the amount of spam I get is staggering.
Google is the worst offender in my experience. They don't take spam reports and they don't do a good job of filtering users' inboxes. Sure, there's a SORBS list to bounce mail from hosts that have bogus WHOIS info... but then you block Google... and everyone uses Google... so you just get to put up with all the spam they send out. From the other end, my gmail inbox is nothing but spam these days (the report spam link is generally useless).
Not in my experience. I'm in general very happy with the results of SpamAssassin. Occasionally sth. slips through but when I compare it to my gmail account it's not worse, maybe even better. The only thing I use in addition is postscreen  (pregreet test only) to stop the dumbest category of spam bots.
If I had to worry about IMAP, Webmail, etc. I wouldn't run my own.
Not quite the same calibre, but really, SpamAssassin+RBLs tuned a smidge too high plus a user whitelist is pretty darn good. Scripting something that auto-adds to whitelist based on sent mail would do even better (but is exactly the kind of 'fun' that people don't have to deal with using 3rd party service). I've heard you can do better with dspam.
I have been using mailcow for years now and it does all of this for me and works great. The UI is beautiful and intuitive. And setting up mailcow literally takes a few of minutes, since the project was ported to docker. Highly recommend it.
That seems like an awful amount of work / overkill. This is not a good introduction for a normal geek, and die-hard open source fans will figure it out without too much trouble anyway.
Postfix is not the best choice for novices, FreeBSD is not the most well-supported/documented system just because it's not as popular as some others, and a directory service shouldn't be necessary.
We had to setup Exim, Postfix or Sendmail for school. Sendmail was universally hated the most, Postfix came in second, and Exim was... well, not exactly logical or easy, but the best of the three mainstream MTAs.
I'm running hMailServer at home. Windows-only, unfortunately, but until I find a proper replacement, I'll just keep running it in a VM. Nothing else even comes close in admin-friendliness. It's just install and run, with either a local admin interface or a web interface (using PHP, so it runs anywhere).
I'll give you that in general, mail servers are not for novices, and they have a huge array of configuration options, but Postfix is by a wide margin the best piece of software that I've come across the last couple of years, and I've been using it for a long time because of that.
It's reliable, it works exactly as documented, it's up to date, it's documentation is excellent, and it's community helpful, if overly precise - but then that's exactly what makes it so good.
I've literally never come across any problem with it, that turned out to be problem of postfix.
I can't say that for any other piece of software that I know.
I invite you to look at hMailServer. I set this up when I had a reasonable clue about SMTP and only a vague understanding of POP3 or IMAP. Let alone how spam filters worked ("they look at words like viagra" was my understanding) or what mailing lists are.
It's really a Windows-like utility in the sense of next-next-next-finish. By now I despise most Windows Server wizards for not being flexible enough and prefer command line tools on GNU/Linux, but this mail server is one thing I just cannot find a good replacement for, and the interface provides everything I need (no need for command line or config file magic).
For a simple domain you only have to edit a few lines that numerous tutorials cover. Combining it with dovecot (similarly well designed, secure, popular, battle tested etc) makes for a robust setup.
Sure don't make the mistakes the OP made and allow relaying for the the entire internet. I can't imagine any sane tutorial has relaying enabled by default.
I've never heard of hMailServer, but hard to imagine it would be worth while and I wouldn't want to bet on it being around in 5-10 years. If editing a few config files and changing a few lines scares you then don't run a mail server. Otherwise pick something popular, well tested, and robust. Sure postfix+dovecot isn't the only solution, but I wouldn't pick something small/obscure/new either.
The documentation for the base system, however, is very good. The man pages are complete and well-written, and the handbook is a great source of documentation as well.
Which was my point. I know it's better integrated and has better documentation (some coworkers were fans, plus what I read online about it), but I still think going with mainstream is the better choice when writing a general post like "how to run your own mail server".
Not that guides for "how to run a mail server on FreeBSD" shouldn't exist. Just that then it should be called that, and not be general advice to anyone who might be googling the general title. There's so much bad press for running your own mail server, while really it's not that hard with the right tools and explanations.
If tweaking spam filters and deleting spam is your idea of fun, then run your own email server.
Thanks for bringing up the painful memories of adding new filters each night. So glad those days are over for me.
edit: Although some training (i.e. manually moving spam to IMAP-Junk) was necessary during the first few months.
The only spam mitigation I use is greylisting and blacklisting.
Failover is manual. I would create a new vm, install debian stable and run a script I've prepared a script that installs packages, copies config files and creates users. Downtime with email is not a big deal, servers will retrying sending for a few days. If you have users complaining to you it's obviously a bigger deal.
Then I'd block the spam only domains like .click, .link, .party, .top, .webcam, .xyz, and .stream.
That should be enough to get you close to zero, sure having spamassin learn based on your Junk folder will help improve things.
I've run a mail server for 20+ years and never had a spam issue, periodically I do updates spam assassin of course.
since the machine is a webhost as well, also hooked up spamc to mysql for better SA performance while still keeping per-user procmail + sa config
I know the article is concerned with owning your own data, and I appreciate the point. But finding a mail provider that meets your needs is, IMO, a better way to spend your time than just saying "Gmail isn't good for me, so I'll do my own."
I dunno. I feel like I'm sitting on a timebomb. It's hosted on DigitalOcean and while it works great with RoundCube and gmail... eh. I dunno why I even did it in the first place.
I'm also a developer, btw. This mail server is only for me so it's not a big deal but if I had to I'd probably be comfortable setting it up for a small business. I wouldn't recommend it for that still, though, since you are the support in that case.
This just isn't true. You can host your own mail server and GMail will probably still end up hosting a large fraction of the email you read and write, because the people you correspond with are still using GMail.
(In the same vein, you can refuse to have a Facebook account but Facebook probably has a dossier on you anyway. Enough people you know have dumped their contacts into Facebook that they already know your place in the social graph.)
You can and should work to reduce your footprint if that concerns you, but there are still systematic issues that make it hard to stay completely outside of there services. Mainly what OP mentioned with contact uploads.
My setup is similar, but it uses MySQL instead of LDAP.
I love being able to make aliases and even better - deleting them when I'm done with them.
Unfortunately most MTAs aren't configured to check the certificate chain, so they'll happily take any SSL cert they're handed and start chatting. MITM or downgrading is trivial.
There is an IETF draft ( MTA-STS ) from 2017 that should address this.
Running your primary email on these big hosting companies is taking your privacy and pissing it right down the drain.
It's really not that hard folks.
iRedmail - https://www.iredmail.org/
Mail in a box - https://mailinabox.email/
They allow you to setup your own mail server and yet make it easier to get started.
I have been using iRedmail and it has been working well so far.
Not sure how you go about colocating a Mac Mini in a datacenter though.
When you ask your ISP for a static-IP address, your service goes from Residential to a more expensive Business account, and they open up outgoing mail ports. (At least for Verizon FIOS that I'm on, pretty sure Comcast is same as well.)
Cloud IP addresses are probably more problematic for spam blocklists.
Curious though, can you also set your own reverse DNS entry for your static ip? I’ve found many mail servers will reject your mail if rDNS records don’t match up.
Getting reverse DNS was easy. Following the directions I found via Google I went into the Comcast business service forums, read their pinned posts and sent a PM to the current service guy. He set the reverse DNS for me. It took about a day.
It seems to be a flaw to have reverse-DNS block mail servers, since a single mail server might serve multiple domains. (My server serves email for multiple domains)
Prepare for changes to macOS Server
The services deprecated include davmail, dovecot and postfix. They say the changes are "to focus more on management of computers, devices, and storage."
Guess I have to move everything to my FreeBSD server now..
Exim MTA, Courier IMAPD on Debian.
Pretty easy setup; nothing complicated.
For remote access I use two things: RoundCube webmail, and K-9 Mail on Android. For sending mail from K-9, I connect home, via authenticated SMTP which is on port 587, rather than 25.
I have developed a little web app called Tamarind for generating throw-away mail aliases.
I run some mailing lists which use GNU Mailman. For archiving them, I don't use that horrible pipermail, but rather a hacked version of Lurker. I patched Lurker to pass through HTML so that HTML mails end up rendered as HTML in the archive. The HTML has to be scrubbed, so I wrote a little scrubber for that:
Second, if you must... I'd recommend Mail-in-a-Box. MUCH easier to setup / maintain than this one, at least from a cursory read. https://mailinabox.email
I used to run my own email server for around 15 years with minimal issues, but I gave up when my mail started disappearing into the hotmail/gmail/yahoo blackhole.
And then ... after you've done every damned thing exactly by the book, and DKIM'ed the dickens out of your headers, killed the spam, policed yourself off the blacklists, etc. etc. - turns out you might as well not have bothered. The googles and the microsofts (the microsofts especially!) will one day drop your outgoing mail without the slightest notification, because the ip range, or because the full Moon, or just because they can.
I ran that show for nearly fifteen years, but threw in the towel last year, and handed over to Fastmail. With regret, although their service is first rate.
Email is not a succesful federated protocol these days. The monoliths effectively killed it off.
I also learned that having it in your basement means trouble: Someone pulls the plug, your IP changes or ends up on a spam list. For some years I ran my own server on a DO droplet. It is very cost effective when you can make as much mailboxes as you want for family (+ unlimited aliases, addresses that deliver to both you and your wife, being able to email 500 mb to familie, etc). I still don't know down what sinkhole emails to my brother-in-law's outlook.com address went down. The literal response of MS at the time: We don't manage our own spam filter, try adding more text, make it look more real...
But man, the pain, the complexity, the reverse DNS, the startTLS, the SPF record, the DKIM records. It took me a long time to understand the difference between mail servers and MTAs and why there are different ports for them. Also, few providers in the Netherlands even allow you to use port 25, luckily mine did. Email is truly an old protocol that has been hacked up-to-date (more or less) and setting up your own mail server will make this very clear to you :)
I'd recommend it though, you'll learn a lot! But to be honest, I now pay 3 euros a months to a dutch email provider because email is too important and I didn't want to go through the pain again when 16.04 came out. I might still have a go at it in the future, there is something beautiful about running your own email server :)
One nice thing about the programs he chose is that their config options are fairly stable (can't vouch for Solr). That many moving pieces would be absolutely unmanageable if the options changed frequently. Been using a similar setup for years without difficulties.
Adding something like fail2ban into the mix wouldn't hurt.
If you're going to do this, first check that your VPS / ISP allow inbound traffic to port 25/tcp. AWS allows it upon special request. GCE doesn't. Don't know about the others. In the US, most residential ISPs block 25/tcp inbound.
Its useful as quite often youll get blocked just for being in the same IP block as a spammy server. My experience to date is that once you notify them your IP isnt the culprit the block gets removed pretty quick.
Curious if you looked into other mail server options? I mean Postfix (not Postgres) easily handles the load of a single user, but it is still rather hard to configure and modify.
I recently started to work with Haraka and even thought its ment for high traffic use cases i wont ever look back to Postfix (not Postgres).
Postfix is super easy, and well documented for normal use cases.
In any case you should ask the author, as they are currently active on another discussion where they linked their article in a comment: https://news.ycombinator.com/item?id=16238501#16238845
>perlgod: I've spent years tweaking my mail server setup (Postfix, Dovecot, RSPAMD, LDAP...) and did a full writeup a few months ago. I've used other guides online but found most of the rest lacking on details
And yes, damn it. Fixed
Switched to Fastmail and haven't looked back. Their Android and Web client are great and they've opened their JMAP interface.
I set up my configs ~5 years ago, and other than apt-get update; apt-get dist-upgrade, I havent had to do anything
Instead of running each component individually, I would recommend looking at something like Zimbra or another OSS mail package that handles a lot of this.
I hosted my own email for over 10 years and maintaining the bits are as painful if you don't have a plan in place.
A decent comparable for do-it-yourself hosting is the kind of luck a product like MDaemon provides - it decent job on windows of rolling all the features into a reasonably manageable server, as well as being quite affordable. I don't work for MDaemon, but tools like this make hosting email relatively trivial.
Fighting spam effectively is not trivial.
1) install spamassassin
2) turn on greylisting
During if you want to to from 1-2 spam a day to 1-2 a month you might want to block the garbage domains like click, link, party, top, webcam, xyz, stream etc. Probably worth enabling a DNS based block list.
So an apt get or two, 2-3 lines in a config file. Seems trivial to me, most every mail server HOWTO mentions them, should be just a cut/paste.
Sure 9-12 months from now it won't work as well, thus updating SA periodically, just like anything else internet facing.
I thought about Fastmail, but its too expensive when you want to do more than one email address or domain. I run mine on a $5 server from DigitalOcean.
The current pricing seems to let you have 100 domains plus 600 aliases for $5/mo.
I've got this thought that I will create aliases for every different thing I sign up for and use them to track who's selling my email address to who. I think that a domain plus aliases will do the trick and I think that what I want to do will fit in their limits.
I can set up 100 domains and 600 aliases, but if I want my wife to have access to email@example.com, does she need her own $5/mo account?
You can add her as a user to your account (so she can use your domain) and it costs an additional $5/mo for the separate user yes
That said, it’s one logical account, so your wife would have access to all folders/domains.
Not true, I run multiple email addresses and domains on my $5 account. Each address is routed to a different folder.
I also accept inbound mx for some of my personal domains, but I don't currently manage my own mailboxes, the mail gets aliased to my Gmail account.
If at some point I get fed up with this arrangement I can transparently change where the email ends up.
It's basically a single binary that has an SMTP server and webmail server. It works absolutely fine for me without much stress. I do hit a couple of bugs here and there, mainly on the mail parsing, but it's not big deal.
However, after reading this, the software developer in me feels like "These tutorials should not be necessary."
This should be a GitHub repo, trivial to fork and trivial to test out locally for anyone.
I.E. like this:
Internet Email (SMTP) -> [MTA + Rspamd] -> [Real MTA + Inboxes]
Sure it's _hosted_ in a centralised place but since you're paying for it Amazon shouldn't have an incentive to harvest your data.
Or rent a cheap dedicated server like Kimsufi or online.net for a couple of bucks per month.
I don't want to become a sysadmin of my own mail server, however I'd appreciate not having my personal data harvested by webmail providers (e.g. gmail, outlook.com). Using a Pi or dedicated server would make me a sysadmin.
Using AWS email seems like a decent middle ground which isn't too expensive ($0.10 per 1000 sent and $0.10 per 1000 emails received).
From reading their blog you can tell that they are passionate about email.
It is a bit pricey for a personal email with a few accounts, but I'm happy to give them their well-earned money.
The easiest way to get this type of VM setup going is to start up the container on your mail host with all of the fun features (filters mostly) turned off, verify that the new mail container works as expected, then slowly start turning on features one by one so that if you happen to break something with a bad configuration you know how to roll back to a configuration that is functional.
If you like email Zimbra's great - it's a fully baked mail server which you install on your Linux distro of choice and it goes off and installs all of the above for you. Everything is managed via a GUI and you have a great web interface and standards based IMAP, CalDAV support.
If you buy the paid version you can even get ActiveSync and Exchange Web Services for it.
Despite all that though, I would give anything to have all those countless hours I put into running my own mail server back. It is a colossal time sink. I can't even stress how much work it is, especially if you have anyone relying on the box for their primary mail account. It's no fun at all.
You're gonna be debugging Fetchmail for when you or your user's want POP3 accounts downloading mail locally. Procmail for filtering. SpamAssassin (gawd if ever there was something which consumed my life it's that software and its myriad libs and helpers), not to mention familiarize yourself with DNS MX records, SPF, DKIM etc. etc.
All of the above works surprisingly well and is fairly solid - until it isn't. When Google added DKIM/SPF protection and blacklisted servers which didn't was a fun weekend that I'd rather have spent with my family. When customer emails started bouncing because their IPs had hit an over zealous RBL list which Zimbra was using was a fun afternoon of debugging. When Zimbra decides to randomly let in 10-20 spam emails a day into my mailbox is another weekend project which I've yet to get round to. Thank god I'm self employed is all I can say because no employer would tolerate an employee putting the care and feeding required to maintain a personal email server!
Unless you want to nurture a career as a mail sysadmin seriously, don't host your own mail server.
Bottom line I'd recommend to anyone thinking about hosting one to either:
2. Use Microsoft Exchange Server
3. Use Zimbra
4. Seriously, don't - consider Fastmail, Gmail, O365 or Protonmail instead.
Looks pretty daunting to me
The only feature I've ever longed for is a simple way to include a non-reply email in another email message. There's probably a plugin for it.
Postfix supports a selection of block lists for spam, and I get no spam at all - although unfortunately my gf sends me email from a Yahoo account, and certain Y! servers get blocked, so that mail bounces.
She doesn't do it often enough for me to spend more time getting whitelisting to work. (Currently it doesn't - I don't know why.)
The hard part is getting a working config file for postfix, but there are tuts and examples online.
Like a lot of older FOSS code, postfix is basically an insane collection of every possible switch for every possible feature, dumped with no particular thought or care into a single config file, and written up - ditto - in a single help file.
You only need about 10% of it, but you won't know which 10% until you try.
The server gets regular hack/relay attacks from all over, but those get killed by Fail2Ban. I'm not exactly a high profile target, but unlike an old WP site I used to run - it was hacked in weeks - the servers seem to have survived for more than five years now.
In the interest of security I'd help your gf to a different provider.
For example, suppose I have things set up so all outgoing mail from my home goes through my SMTP server. If I send an email with a from address of tzs@mydomain, then the setup in the article is perfect.
Suppose, though, I send an email from home with my from address set to tzs@employer, where "employer" is my employer's domain? Assume this email is not to an @employer address . With the setup in the article (and in almost every other similar setup I've seen covered in similar articles) this might run into spam filter issues unless I've convinced my employer to add my SMTP server to their SPF record.
The way I want this to be handled is for my SMTP server to see that the mail is from an @employer address, and instead of trying to deliver it directly, relay it through employer's SMTP server.
This is similar to the common "smart host" configuration often used when you run an SMTP server at home, but want it to send all outgoing mail through your ISP's SMTP server instead of trying direct delivery. Essentially what I want is a conditional smart host based on the from address.
Postfix supports this. In fact, it seems to support it in a couple different ways. I played with it a bit but could not quite get it working.
What I'm doing for now, until I find out how to do it right, is only send work email outside of work from my desktop Mac. I took tzs@employer off the list of mail aliases for my mydomain mail account, and created a second account in Apple Mail for @employer. I set the incoming mail server to POP3 on 127.0.0.1 so that it would fail, and set the outgoing server to smtp.employer. It complained for a while that it could not contact the POP3 server, but eventually stopped complaining, and the address in the configuration dialog changed to 0.0.0.0.
With that setup Apple Mail sends mail from @employer directly to my employer's SMTP.
Sometime recently, after an OS update, that stopped working. It would no longer let me enable an account unless it could successfully talk to the incoming mail server for that account.
I did find an ugly workaround for that. I gave it the correct address for employer's POP3 server, and the correct password. Once it was happy, I went to Keychain Access, found the saved password for the POP3 server, and changed it in Keychain Access to something incorrect. Mail then complains that it cannot login to the POP3 server, but that does not cause it to disable the account. Net effect: a send only account in Apple Mail. (It is important to do the password change in Keychain Access, not in Mail, because Mail won't save the change until it sees the new password work).
(If that had not worked, I probably would have written a dummy POP3 server that always reports no mail and used that).
 This happens reasonably often for me, because I have my mail server set up to use fetchmail to fetch my incoming work email and deliver it via procmail. Same for any other SMTP accounts I have. That way I only have to configure mail clients to work with mail server and I get access to all my mail from all of my non-web email accounts.
If Apple mail is broken and keeps dropping things I'd suggest thunderbird.
Then I have to have my desktop email client set up for both personal and work email sending, and my iPhone email client set of for both, and my Surface Pro 4 email client set up for both.
If everything, both sending and receiving, goes through my server, then all my client devices just have to use that one server.
In general, it just seems cleaner to keep the email clients as simple as possible and put as much of the decision making as possible on my server.
I swear, I don’t work for Fastmail, but I’d much rather use them (or any email provider that is halfway decent) than fiddle with my own mail server.
One of the easiest mailserver setups i've ever had.
If you don't like that it's not super free, there's open source alternative: https://mailu.io/
I even put together a self-contained single-DVD installer that would install and set everything up securely and solidly. (I don't think I have a copy any longer and if I did it's very out of date)
I still don't recommend doing it. Even for the security-concious. It's just not worth it.
The use case is to transfer arbitrary files over a local hotspot.
I tried installing from the Apple TV tutorial, but it put my iPhone in a boot loop.
Just a chance, but are there any iOS jailbreakers here who could advise?
Running a Postfix on anything else than a dedicated server with a static IP is a pretty bad idea (half the internet will reject the emails you send).
And to do all that just to transfer some files is probably like using an iPhone as a fly swatter.
For example, sharing a photo album with many pictures. Or a mixtape. Or some song lyrics. I can't upload those to the cloud for copyright reasons.
Or if I want to make the transfer while away from Internet e.g. skiing, hiking, waterfall trip, etc. - there's no access to Internet services, so iCloud/Dropbox/Google Drive just won't do.
I can use lighttpd to serve the folder, but then the user has to hold down and "Save to Camera Roll" for each picture separately.
If both phones have Airdrop, then that's fine. But many phones are not iPhones. We could both install a special app for Bluetooth transfers, but we don't have Internet access, remember? So no app store.
There's a Mail client on every phone, however locked-down it is. If I can serve a collection of files over a local network and send those directly, not one at a time, then that would be very useful to me.
I think a mail server is one solution. If you can propose another flyswatter that meets my requirements, go ahead. Otherwise I still want to find a way to code a mail server, and the parent article is helpful for that.
Why not install the special Bluetooth app whenever you were planning to install the smtp server?