Lurker News
Recently I decided that I wanted to run my own MTA. Downloaded qmail, applied a couple of patches and it was done. The problem is making sure my mail is not marked as spam by the major MTAs out there, gmail and hotmail both mark my mails as spam. So far I've:

- made sure I'm not running an open relay (obviously)
- made sure a reverse lookup to my IP matches my host
- made sure my IP wasn't already in any spam IP blacklist
- added SPF
- added DKIM
- run a lot of tests at glockapps.com
It's still not enough. I don't know what else to do, is it possible to run your own MTA, for personal use in 2016? Who, here, is doing it successfully?

Comments (299) 108 threads

Nux13 replies#
It's absolutely possible to run an email server in 2016 and I encourage anyone capable to do so!

Email is one of the bastions of the decentralised Internet and we should hang on to it.
Every day more and more people are moving to Gmail/Hotmail/Outlook and while I do understand the reasons, it also puts more and more power into the hands of these providers and the little guy (us) gets more screwed (like marked as junk by default by them :< )
Having said that, here's my check list for successfully delivering email:
- make sure your IP (IPv6) is clean and not listed in any RBL, use e.g. http://multirbl.valli.org/ to check
- make sure you have a correct reverse dns (ptr) entry for said IP and that ptr/hostname's A record is also valid
- make sure your MTA does not append to the message headers your client's IP (ie x-originating-ip), messages can be blocked based only on "dodgy" x-originating-ip (see eg https://major.io/2013/04/14/remove-sensitive-information-fro... )
- set up SSL properly in your MTA, there are so many providers giving away free certs nowadays
- SPF, DKIM, DMARC - set them up, properly, this site can come in handy for checking yourself https://www.mail-tester.com/
- do not share the IP of your email server with a web server running any sort of scripting engine - if it gets exploited in any way usually sending spam is what the abusers will do
- last but not least - and while I loved qmail and vpopmail - use Postfix or Exim, they are both more fit for 2016, more configurable and with much, much larger user bases and as such bigger community and documentation.
HTH

colejohnson661 reply#
Burn how do you ensure your mails aren't tossed in the spam box of the big ones?
rasjani#
Each of the points mentioned in the post you replied to contribute to the decision if big players mark your mails as spam or not.
darkhorn#
Plus make sure that your whois is not registered behind proxy registrars. In other words use your real name and real email address.
madez1 reply#
I disagree with you. I consider email legacy technology because of its reliance upon DNS and static IP addresses. These two requirements make hosting email unnecessarily costly.
a3n1 reply#
What replaces email?
quickben3 replies#
For most of the people I interact with, and most of the usecases: Viber

Continue this thread — 3 replies

noinsight2 replies#
I would suggest running OpenSMTPD over any of the alternatives, it's much easier to configure and should be/remain secure as it comes from the OpenBSD people (the audit from Qualys attests to that).
X86BSD1 reply#
Yeah I'll have to disagree here. I beat my head against this horribly documented MTA just trying to get virtual users to work with a relay host. I gave up after three days of slitting my wrists trying to get it to work. It's horribly documented, getting help out of the obsd folks is like getting blood from a turnip, but if it works for you great! But I would never agree it's easier to configure or has better documentation than postfix.
MustardTiger2 replies#
I'm genuinely curious here since opensmtpd has been by far the easiest to configure MTA I've ever seen. What problem(s) did you have? Virtual users through a relay host is literally one simple line:

    accept for domain "example.com" virtual  relay via relay.example.com
I don't see how anyone could conclude that is more difficult than postfix.

Continue this thread — 2 replies

noinsight1 reply#
Yeah those issues were found in the Qualys audit. They have been fixed so the codebase should only be stronger now.

I just wish we had something that wasn't written in C.

Continue this thread — 1 reply

thomasjames1 reply#
I recently ran into issues with the PTR on a mail server and did the lazy/unsustainable move of just disabling IPv6. Wish I had found this post before!
mgbmtl#
If you can't control your PTR on IPv6, in postfix I recommend using: "smtp_address_preference = ipv4", instead of fully disabling IPv6.

This way you can still receive email from IPv6 servers.
I run an smtp server from home with a static IPv4 address (for which the ISP lets me configure the PTR), but their IPv6 is "beta" and they don't yet support delegation, which is rather frustrating, but different topic.

merb3 replies#
SPF, DKIM, DMARC could be dropped if you actually use aws ses to send your mails, you can actually forward the mails there. So it's pretty impossible that your messages will be in spam. The only thing you need to manage is incoming mail now and not being a open relay.
cddotdotslash#
And if you still want them, AWS supports enabling these for your outgoing emails.
loup-vaillant#
Hence defeating one of the main purposes of running your own mail server in the first place: decentralization.
matthewking1 reply#
Unfortunately SES servers seem to be regularly blacklisted. A quick google confirms. I've been using SES for 3-4 months now and had a few hard bounces with specific mention to the IP being banned.
voltagex_1 reply#
The last spam that got through GMail's filter was from amazonses.com. It wasn't clear how to report it back to Amazon.

Continue this thread — 1 reply

jwr5 replies#
> Email is one of the bastions of the decentralised Internet and we should hang on to it.

This.
I hope someone will eventually create an "E-mail server in a box" package for Ubuntu LTS, so that more people can run their own E-mail. I'm not saying it has to be super-easy for everyone, just that it should avoid unnecessary chore work (like configuring postfix to always use TLS, or plugging postgrey into postfix).

nickpsecurity2 replies#
That attempt at the problem looks pretty nice. Thanks for sharing it.

Continue this thread — 2 replies

malbs#
a recommendation for mailinabox, I've been using it for about 6 months, very nice
tqwhite3 replies#
I've been using it for a year. Works great. One of the most thoughtfully designed and complete bits of software I've ever run into.

I'm especially delighted with it's self monitoring and the status change email messages it sends me.
That it includes webmail and gives me a nicely featured DNS server only makes it a touch more awesome.
I run it at Digital Ocean for ten bucks a month. I support family and friends. My email does not pass through google or microsoft servers and that makes me very happy.

Continue this thread — 3 replies

Continue this thread — 14 replies

Continue this thread — 3 more replies

Continue this thread — 6 more replies

mrb6 replies#
One little trick that I rarely see mentioned for working around the negative or neutral reputation your MTA's IP might have is that you can route your outgoing emails through another MTA that has a higher reputation. For example route them through smtp.gmail.com (or for other options see https://support.google.com/a/answer/176600?hl=en). It does not mean you have to use Gmail. It does not mean you have to change your MX records. It does not mean you have to use a @gmail.com address. None of that. Your recipients will not even notice you are routing through smtp.gmail.com (unless they inspect the detailed headers). All you need is a Google account and password to authenticate against smtp.gmail.com, and Google will happily route your email to wherever, to any external domains, etc.

Doing this makes you retain all the advantages of running your own MTA: none of your emails are hosted at a third party provider, no scanning of your emails to personalize ads, no government agency can knock at the door of an email provider and ask them for the content of your inbox, etc.
The only downside is that in theory Google can scan and block your outgoing emails (not incoming emails since these hit your MTA directly). But if you don't send spam, this should never happen.
Another option is to route your mail through your ISP's MTA. Yes ISPs usually offer SMTP relay service accessible only from their customer's IP addresses (eg. for Comcast it is "smtp.comcast.net" IIRC.) However the reputation factor of an ISP's MTA might be worse than Google's MTA.

nilved#
There is no way that Google is not recording messages sent through smtp.gmail.com.
djsumdog4 replies#
Huh..never thought of this. I run my own e-mail server on a Linode. I have constant trouble not being classified as spam. I did a whole post on it:

http://penguindreams.org/blog/how-google-and-microsoft-made-...
The sad reality is, I'm thinking of moving my e-mail back to someone else. It might be Fastmail, might be Amazon. Running my own e-mail server is a pain and I hate having to send people a message on Facebook or Reddit saying, "I sent you an e-mail. Check your spam folder."
If I route my e-mail through Gmail's SMTP server as a relay, that shouldn't affect my DKIM/SPF stuff right? I'd just have to change SPF/DMARC to say gmail is allowed to relay messages for me, correct?

x0x01 reply#
I did a similar thing 2 years ago and chose Fastmail. Their web-app is best of breed ex google -- unfortunately, the honest truth is nothing is as good as gmail web + gmail apps + google cal.

Fastmail does have more issues -- lack of fit and finish, their web app is sometimes buggy, their spam detection is buggy, it's imap, the lack of gmail style conversations being the fundamental unit of work in the app shines through sometimes, the gmail app on android does not interact well with fastmail, etc. However, they have recently fixed my biggest complaints: charging 11 cents per sms message to do 2fa and their rules interface looking like it was written as a my-first-javascript project. So it's actively improving. I like it enough that I recently re-upped for another two years.
They do enjoy one big advantage over google besides privacy: tech support! Like a human, that reads and responds to issues submitted through their site! I've contacted them twice with questions about setting up my domain and one other thing and I got replies, from someone who knew what she/he was doing, within an hour each time!
Also, they will do a catch-all address (eg xoxo@xoxo.com) which receives email from every address not specifically defined. Thus you can implement the best anti-spam technique: every email you give out is domain@xoxo.com which forwards to you@x0x0.com so you can tell exactly who sold or leaked your email address. eg latimes@x0x0.com was sold all over the place.

PaulHoule1 reply#
I love fastmail. Really I do not like gmail style conversations so I prefer fastmail over gmail.

Continue this thread — 1 reply

mrb#
Yes in theory all you need to do is update your SPF to whitelist Google's SMTP relay.
mgbmtl#
Silly question, but have you tried sending an email to someone running spam-assassin and check the headers of the received mail to see if there's anything obvious flagging you? For example, on Linode make sure that your reverse DNS for IPv6 are also set correctly.

I find it hard to believe that you get classified as spam for no good reason, unless perhaps that Linode / Digital Ocean are known for hosting so much garbage and people can be tempted to outright block them, but I doubt Gmail does that?

LinuxBender#
I've had my mail servers at Linode for about 8 years now, no problems at all. If anything, I am more restricted on mail processing rules than anyone else.
nokya3 replies#
This completely defeats the original purpose of this HN. Why would anyone invest effort in hosting an independent email server to have all its content routed clear-text through Google's servers/databases?
tezza#
They are talking about MTA output. Mail input and archiving are still important factors.

I personally want to control my input addresses.
Hosting your own you can get funky wildcard postboxen.
Hosting your own you can archive all the mail without 3rd party approval.
I can see the advantage of the small amount of outbound being via someone else.

mhurron#
I have a VPS I use as a smart host.
huskyr1 reply#
Because your mail will end up at Google anyway? Even if you don't use Gmail, all your friends do.

Continue this thread — 3 more replies

walrus0111 replies#
Having a perfect smtpd that speaks TLS 1.2, has properly set up dkim, sfp and dmarc records, working reverse DNS, etc is sadly not enough these days if you use a commodity vps/VM host. IP block reputation matters as well. Sadly, some other customers in your same /24 have been less clueful than you within the recent memory of major SMTP operators(gmail, office365/Microsoft, etc) and your IP space probably had a bad reputation.

Reputation perception by opaque large SMTP operators will not show up in RBLs and other ways to check for blacklists. You cannot query your IP block's status unless you happen to personally know a senior sysadmin on their mail operations teams. They don't share this information because it would help spammers choose new "clean" places to spam from.
One solution is to Colo your own 1u system with an ISP that is known to have very stringent zero tolerance abuse policies. Typically not one that is a commodity hoster.

Continue this thread — 11 replies

ChuckMcM1 reply#
Absolutely possible but its a battlefield on the Internet so you have to understand the players. Two things I haven't seen mentioned in all the excellent advice:

1) Does your ISP let you send email? Some ISP's will not allow any outbound traffic to port 25 from a non "business" port. They force their users to send their email to their server, and then they forward it on to the Internet.
They do this with nominally good intentions (it is easier to control spam generated from their networks), but they also are financially motivated to do so.
2) Don't try to send mail from a dynamic IP address, you should have (and would probably pay extra for) a fixed static IP address (V4 and V6).
Dynamic IPs have two problems, one they change and mail receivers don't like that. Two, they carry with them the abuses people who had the IP address before committed. So your email may get delivered one day, and then poof you renew the lease on your IP and get one that is on a black list somewhere.

Continue this thread — 1 reply

Load more comments