648 points · by jdmoreira · 10y ago · 299 comments
- 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?
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
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).
Everything is configured with a single docker-compose, read about it here: https://news.ycombinator.com/item?id=11748036
It has a decent web admin panel built-in to the box and also a copy of RoundCube Webmail. It'll even automatically set-up LetsEncrypt SSL for you.
You might want to set-up rainloop manually though because RoundCube isn't the best.
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.
There are a lot of moving parts, and being an email admin requires some maintenance like being vigilant about not allowing spam. An automated script to set it up for people who wouldn't know how to run it would be doing those people a disservice.
Some of this may be able to be automated, but that's the hard part; not installing and configuring a few software packages.
It's such an easy-to-use email system. Been working great on a home static-IP address for me for a couple years now.
accept for domain "example.com" virtual <users> relay via relay.example.com
I don't see how anyone could conclude that is more difficult than postfix.PS. maybe that's one of the vulnerabilities mentioned in the report (1). Anyway it's an argument for me to run Qmail/qpsmtpd instead.
(1) https://www.qualys.com/2015/10/02/opensmtpd-audit-report.txt
I just wish we had something that wasn't written in C.
I'd feel nervous about doing this at home. For one thing, my ISP is a residential cable internet provider, and not 100% guaranteed uptime as a result. I'd hate to miss mail or worry whether I did.
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.
ITYM federated Internet, agreed though.
Better yet, opensmtpd.
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.
Are you an EC2 user, well there is a black list for those IP's. Are you on a residential connection or a dynamic IP... there is a black list for that also. So you may have a perfectly configured MTA with a pristine IP and still have delivery issues. Using a smart host is perfect in these situations.
It's been mentioned before but part of running your own mail server is the process of learning and tweaking things to your liking. I remember the days when you could run a server on your own home connection on port 25 without any issues - but those days are long gone. A crucial part of every sys admins journey historically has been setting up and configuring a personal use mail server.
You can always run a mail server at home on a port other than 25 and have an upstream email service deliver it to your alternate port.
So if you'd rather not deal with filtering your own spam, or would like a excellent smart host with SPF and DKIM - let me know.
I'll provide commercial spam filtering with backup MX or smart hosting services to any HN user for 50% off from duocircle.com - just message me... running your own is sort of a right of passage.
I've smart-hosted using postfix, direct for incoming and gmail/sendgrid/mandrill (before it was neutered by mail chimp) for outgoing.
It was fairly cost effective - generous free tier (upto 12k emails) for outgoing, and a small vps to host postfix (~$5/month).
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.
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?
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.
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?
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.
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.
That's an understatement. Reading Hotmail's policy, I saw a blanket ban on dynamic IP address. Your mail won't even attain the spam box of your recipient. It will bounce right away. Other big providers probably do the same.
In many cases to successfully sending a mail from a dynamic IP is flat out impossible.
Make sure you don't send spam and your server is properly configured. If you are sending mails to people that don't want it then it is spam. "They silently agreed to get our newsletter because it was listed in our ToS on page 357" is not acceptable. No other excuse for sending spam is acceptable. Whenever you send any automated mail there must be an easy way to unsubscribe.
A few more tips:
* Check your mail server on http://multirbl.valli.org/ - if it's in any blacklist try to find out why (there are a few rogue blacklists, ignore them).
* Hotmail allows you to receive a report for every mail that a hotmail user thinks is spam. Use that. Act on it.
* Check your logs for messages that indicate that others think you're spamming.
* E-Mail forwarding is a tricky business these days. Avoid it.
I occasionally get dubious spam rejections, but they don't come from the large hosts. They usually come from some small ISP using a proprietary antispam solution that gives you no insight what's going on.
My suspicion would be that qmail is your problem. There are a great many details that a mail software has to get right, qmail often doesn't do what the email ecosystem expects.
Even when I switched mail server IPs twice over the last few years I didn't run into the issues you ran into. A large part of it depends on where you run it - if you, say, run it on your home Internet connection that's usually an immediate strike against you because of the insane number of spammers using backdoor'd PCs to do exactly that.
The only time I ran an MTA out of my home was when I was on a commercial ISP with a fixed IP address, that seemed to be good enough for most services including gmail and hotmail.
These days I run my MTA on a VPS with a reputable hosting provider and don't seem to have that many issues with outgoing mails marked as spam.
SPF and DKIM are pretty much a must these days, so that's a good starting point, as are the rest of the precautions you already too. I assume you're using your own domain, how "old" is that domain? That might also have an impact giving how many phishers and spammers register odd domains and use them for a short amount of time. I've used the same domain since about 1999 so that could make a difference.
I use postfix instead of qmail, but I've used qmail in the past. Both work well and are easier to configure than sendmail or exim IMHO. On top of that I do run amavisd/spamassassin/clamav for the incoming emails as well.
One more thing I've got set up that I didn't see in your list is that I've got TLS set up with a non-self signed certificate for both incoming and outgoing email. I suspect that this also makes a difference even if the other email server won't request a client certificate (most, if not all, won't). Certainly shows up when I send an email over to gmail.
My biggest issues these days are more with incoming email:
- You'll never get to the level of spam filtering that, say, gmail offers. To me, that's OK
- I use greylisting to weed out a lot of the spam that would normally make it through spamassassin, but unfortunately that's when you find out how many people have misconfigured servers that bounce emails when they encounter temporary failures
I don't actually greylist any more, though -- I've found that postfix's protocol violation detection (postscreen[0]) is just as good, if not better, and I like my mail to come through immediately :).
Amavis is set up to do pre-queue filtering, which means that mail is either rejected or delivered (possibly to the spam folder), my server shouldn't be generating its own bounces or dropping messages on the floor.
For years it was qmail, but when I wanted to use SMTP/SSL as much as possible, switching to Postfix was easier than maintaining all the qmail patches.
I switched over to Let's Encrypt certs several months ago, and those have been working out quite well for me.
As far as I can tell Comcast employs a number of very competent network engineers and an astounding number of horrendous customer service and executive managers.
Didn't you mean "outbound"?
While true, some IP addresses were not previously used, either by home connections or by anyone, so you may be in luck there. There seems to be a correlation with my latest IP switch (three years ago or so) and less mail server trouble.
Most services are also smart enough to learn to trust IP addresses after a little while. Even when SPF and DKIM is ignored, this usually solves it in a few emails.
ISP state in their TOS you are not to run "servers" from your home connection, as such they simply blacklist all Residential IP;s from the start, because if you are running a email server on a Residential Connection it is either a Botnet, or you are violating the TOS of your plan.
I don't know what evil ISP that is but running your own server is 1) encouraged by my ISP since forever (XS4ALL, the Netherlands) and 2) these days it's illegal to tell people not to run servers because of net neutrality laws.
ISPs definitely seem to have an impact as well, but some spamfilters at least used to automatically assign a negative score to anything originating from an IP block used by an ISP for domestic Internet connections.
I had problems with mail acceptance only once, when one of my ISPs got me an IP address that was either used by a spammer in the past, or was in the same subnet that the spammers used. Other than that, no problems over the past 15 years, and I switched providers and systems at least three times over that time.
I'd encourage everyone to go ahead and do it. It isn't very hard, cost on the order of several dollars/euros a month, and you finally own your E-mail. I find it appalling that most people either use company E-mail (it isn't yours, anyone can read it, and if you part ways with the company you have a problem) or Google Gmail (Google does read it, trains its algorithms on it, and targets advertising based on that).
Don't worry too much about DKIM. It is no longer a good signal anyway, most spam gets it right.
So, if you're capable of it, go ahead and run your own mail server. I wish more people did it, so that we could avoid the "big guys" restricting E-mail. If more individuals ran their own servers, we could democratize E-mail again: it wouldn't be that easy to just reject E-mail for no good reason.
For the reference, the software I use right now is: Ubuntu LTS, postfix, postgrey, amavis, dovecot. I rent a virtual server at Hetzner.de.
SparkPost allows the use of dedicated IPs and it has a warm up time. They tell everything about it in [0].
[0] https://support.sparkpost.com/customer/portal/articles/19722...
Here's what I've done on top of your list:
- backscatter prevention (using my own https://github.com/pflanze/better-qmail-remote)
- do the Google domain verification dance (postmaster tools, configuring their entry in the DNS); still didn't prevent mails ending up in spam, but who knows whether it might still have helped.
- started running mailing lists on it anyway, in spite of me knowing that mails end up in people's spam folders, and simply tell all new subscribers that mails first end up in their spam folders and that once they mark them as non-spam the problem goes away. This seems to be working (people haven't complained), and will over time hopefully give my server the reputation I need.
(PS. I'm also still using DJBDNS, with a config generator written in Scheme, look out for tinydns-scm on my Github)
I'm using maradns for DNS but I respect djb's software a lot. I'm using his publicfile as an httpd.
I have already added my domains in google's postmaster tools. So far it hasn't helped much
Small users generally don't use Qmail anymore, so if you're a small sender and use Qmail, then perhaps that's odd, and iff spammers (perhaps for Qmail's efficiency (1)) are using Qmail often, then...
(1) although you can attain higher efficiency with a custom MTA that's not safe, i.e. big spammers generally don't even retry for efficiency (that's why greylisting works).
A friend of mine runs several mail servers on OpenBSD, using OpenSMTPD, and says he's got almost zero problems and scratches his head on what I'm doing. So there's 3 hypothetical reasons for that for me:
- basically no spammers will be using OpenBSD (why should they?), - and hence also none be using OpenSMTPD, - and hence also none of them will be using a OpenBSD hoster (netblock!).
Relatively many spammers (perhaps not the biggest ones, but still spammy senders) will be using services like Hetzner, and will most likely be running Linux. Now if Gmail etc. do check the MTA you're running, and perhaps do OS fingerprinting, they'll "know" how to judge you.
Anyway, I don't have evidence that Qmail is a big reason, it seems likely the netblock is much more important (or at least that's what I'm inclined to think because the alternative would indeed be rather frustrating).
Reverse DNS very important and the SPF
Linode have excellent setup documentation ( https://www.linode.com/docs/email/postfix/email-with-postfix... )
I've been running my own e-mail server for years. I have DKIM, SPF, PTR, and everything else set up and my e-mail domains and IP addresses are many years old. Every so often, Gmail still decides to spam-bin me for a week or so.
Eventually though, gmail will typically accept email from home IP addresses. Google apps for business seems to be even trickier than that: they have an opt-in strict setting which blacklists (outright rejects) anything remotely suspicious. It'll tell you where you stand through delivery failures, but it also means you'll end up having to call whomever you're trying to reach.
If you are not being blacklisted (check the common ones plus AOL, they run their own), and are using SPF and DKIM, you shouldn't be having problems with messages getting blocked. That's pretty unusual.
What could be happening is that you might be in an IP range that's residential; there are some operators who blackhole all messages originating from "residential" IPs, even if they are not specifically being blacklisted for bad conduct, and even if they have valid SPF/DKIM records. I think this is a pretty bullshitty thing to do, and completely out of the spirit of Postel's Law, to the point where I think anyone who configures a server this way ought to be forced into a lifetime of Windows XP helpdesk duty. But it's a thing that happens.
One solution that's worked for me is to get a cheap VPS and run my mailserver there. It's in an IP block that traces back to a big datacenter, and it seems to be much more acceptable to various overzealous spam filters than my home IP.
In particular, I know gmail hold IPv6 to higher standards. Some things (e.g. rDNS) that we traditionally treat as 'should', gmail will treat as 'must' over IPv6 - it's being treated as a chance to drop a lot of legacy leeway.
I do run my own MTA. It's not high-maintenance, at all. Understand the pitfalls, iron them out, and then stick with it to build your reputation. There is no magic bullet - the big providers won't tell us how they measure us - the best we can do is be well-behaved, stay well-behaved, and adopt modern standards (TLS, SPF, DKIM, etc) as they're thrown at us.
My best advice is to choose a reputable host. There's a lot of race-to-the-bottom in the web hosting market, and VPS are turning out no different. Keeping a clean house is good for your reputation - but so is living in a nice neighbourhood. It's well worth a couple of bucks extra to find such a neighbourhood.
This sucks big time. We should be able to send email from fucking home, not beg an external, bigger guy to either do it for us (one's ISP, google…), or lend us a machine so we can do it from there (Amazon, OVH…).
Email providing is so concentrated right now it is starting so show signs of network effects —just like more recent (anti)social networks. This is not right.
But if we can send email from random dynamic IP addresses, so can spammers.
And spammers do. I run an MTA (postfix) on a couple of Linodes and I get more hacky spam-wannabe traffic than I get actual mail.
Postfix is configured to kill it all, so I never see any of it. But the logs are spam carnage.
My domains are hardly famous, so if you're running a high profile site I can imagine the problem would be a lot worse.
I have a hard time believing spam is such a huge problem we have to use simplistic filters such as IP bans to deal with them. My email address is written without obfuscation in the open web (my own website), and my email clients' filters (Thunderbird or Evolution, depending) are more than enough once I have trained them a little.
(My domain is probably even less famous, but I do receive cold, non-spammy email from time to time regarding my blog articles.)
Sending an email to a user of such networks has become difficult —at least, more difficult than it should be. Unless of course you come from one of those huge networks. And of course, the users themselves don't see any problem with this: they assume that if you can't send an email to them, the problem must be on your end —not, say, Gmail's spam filter.
On the other hand, if everyone had a little box that send email directly from home, nobody would ever dare to block them.
Basically it's the component that handles SMTP. Local delivery, pop3, imap, etc are almost always handed off to another component.
It's usually the difficult component because it's the service that other hosts will interact with. So if my imap service misbehaves, it annoys me until its fixed. If my MTA misbehaves, it's a lasting black mark against my host's reputation.
mail-tester is free: https://www.mail-tester.com/
(I'm not affiliated with either of these tools apart from using them.)
Check the repuation in the various anti spam blacklists out there * Check IP in multiple blacklist http://multirbl.valli.org/ * Check server IP on mxtoolbox http://mxtoolbox.com/whatismyip/ * If you are using home server IP please consider using a VPS with a good IP reputation. * Consider lookup up ip at Cisco senderbase reputation and check its score, make sure its consider good. https://www.senderbase.org * Lookup ip in Barracuda repuation http://www.barracudacentral.org/lookups (Cisco and Barracuda is because these are somewhat common antispam services at edges).
Don't let that often overlooked weak point be the way every one of your accounts gets compromised. Once they have your email, they have everything that resets via that email domain.
2. Having multiple IP addresses and throttling helps if you send bulk emails.
3. Check email headers of spammed emails, they usually contain valuable info about the reason of being detected (SPF/DKIM ,...)
4. Check the contents of your emails and find out spam score of the content.
5. You can look into commercial solutions like: www.own-mailbox.com
6. Hillary, if it's you, don't do it again!
You can't do everything so you have to pick your battles ;)
Indeed big companies outsource mail servers too, that was very surprising at first but reduce [effective and hidden] costs significantly and with a good SLA they can receive an excellent service.
Postfix occasionally drops a legitimate incoming email due to a misconfigured sender, usually from a domain that doesn't resolve to anything, but I just log those in case I miss something important.
One of the things that is the most frustrating is that if you end up on a blacklist, or a large provider decides independently not to trust you, it's often completely silent when it blackholes all your outbound emails to that service.
I've just moved over to a hybrid of hosting my own MX servers for incoming email, and forwarding all my outgoing emails to an email-as-a-service provider for outgoing messages. Their trusted IPs usually help delivery, and they're actively paid by their users to have employees making sure that their IP ranges are whitelisted.
Authentication-Results: mx.google.com;
and details what it did and did not like about your message. For example, it let me know my mail server had suddenly started sending over IPv6 (actually, Google started accepting there and IPv6 had priority) and I only had SPF records for the IPv4 address. Google's authentication results are the friend of everyone with a personal mail server.
EDIT: Looks like this is one of the things https://glockapps.com/ checks.
https://news.ycombinator.com/item?id=12109727
about some hard-to-find tools that help with Microsoft mail (Live.com / outlook.com / hotmail.com etc). There may have been some similar strange link for Gmail - i only have access to my phone right now, so I can't check my notes.
I believe that was the thing I was missing from my setup (and it was frustrating to debug as mail simply disappeared).
Between a (for now) cacert-certificate (which I think is treated as "self-signed" for most purposes) and SPF - both Google and MS appear to accept my mail. I've turned off ipv6 - if you want it, it might take some extra work.
I'm planning to move to opensmtp "when I have time" and maybe dbmail for the store - now I'm on exim and dovecot.
I get little spam - I do have greylisting set up. What I get is generally to emails leaked in the linked-in and Adobe attacks. I should change those addresses, and reject/black hole the old ones. But for now it's manageable - and is filtered out in my "misc" folder by simple address-basrd filtering (exim .forward file)
(I generally give each site a different mail, se eg my hn profile).
The big guys whitelist each other.
There are (very expensive) services for the medium guys, such as [Return Path](https://returnpath.com/) , that help you keep good relationship with the various ISPs. With many ISP's they even have a very specific whitelisting deal where you literally pay to be whitelisted...I think thats mostly the second tier ones like AOL, Comcast, Yahoo. Gmail for example doesn't play ball with that - but they will whitelist you if you follow all the rules and have a good reputation, which someone like Return Path can help with.
Is the situation shady? Yes. But it rose out of a need for dealing with a real problem (spam), which you have to admit has gotten under control over the last 10 years.
Bottom lime, I would use a 3rd party service.
But that decade probably helps - my mail server has kept the same static IP the entire time, so has a pristine spam reputation.
I added SPF a couple of years ago as otherwise Google was started to look askance at some of the emails sent from my server but I haven’t bothered with DKIM (apart from added a DKIM policy that says “I don’t do DKIM” that is). No problems so far.
Where are you hosting your mailserver? If it’s on a dynamic IP on your home internet, then you’re on a hiding to nothing. Static IP on a home internet might be OK, if you can fix your reverse DNS to be something sane rather than the more usual adsl123455.isp.net or something. Google generally hates reverse DNS entries that look like consumer internet connections.
If you’re hosting with AWS or another cloud provider, then I believe the only way to get an server on an IP address that doesn’t come with a terrible reputation for spam is to cycle through IP addresses until you find one that works - this is what the big mail delivery companies do I believe.
Hello, I run my own mail server, though admittedly with an attitude of "your spam filter thinks I'm spam? That filter is broken; have fun reading your spambox."
Company email addresses are actually never any trouble anyway, only personal ones (the free ones like yahoo, gmail and hotmail) are the ones where people have trouble with broken filters, so I don't think I'm missing out on anything. And even those filters usually learn (after a few emails to different accounts on the service) that my IP address is not to fear.
I add SPF records but don't sign with DKIM (too much trouble; I set this up years ago when I didn't have much experience yet).
The last time I had trouble sending email was with (of course) google apps. Some company, whose product we were required to use by school, had no privacy policy so I wanted to ask after it. Sending them an email, google's mail server outright refused my IP address to deliver a message (this is extremely rare, usually it goes into a spambox). Google is the only one that can get away with this, given the near monopoly, without people thinking it's an issue on google's side. In the end I just didn't send them an email. Also quite ironic that google, of all companies, is the one standing in the way of my email trying to ask after a company's privacy policy.
This was half a year ago. Before that I can't remember having issues with anyone or anything for another year or so. Given how much I use email and how little spam I receive (catch-all with a blacklist), owning a mail server is totally worth it. Also because I don't have to accept anyone else's privacy policy or consider how many people have access to my inbox (I host at home, not colocated nor VPS).
I actually use sendmail with bogofilter-milter.pl script (there is also bogom program with does similar thing) as opposed to usual way of running it with procmail, it essentially does the filtering at the moment it is being sent to you and rejects spam right on the spot. The advantage of it is that sender will get notification that spam was not delivered, also many spammers might drop you from their lists when they can't deliver spam.
Before I explain what I do, I'll just mention that if you run the server that is the destination of your MX record, then you probably also want to run a back-up spooler at a remote site for when the connection to the primary server, or the server itself, is down. Down for security patching, for instance. Running a rock-solid mail service is kind of a pain, because it never fails at a convenient time.
So... I let my ISPs handle the high up-time requirement stuff, and let them be the mail spool as far as the outside world is concerned. Then I pop it down and requeue the mail on a machine that sits behind my firewall and isn't even on the front lines of the internet. I run an IMAP server on that. If it goes down, pfffft, the mail spools up a the ISP for a while and it gets popped down when my sever comes back up. It actually all works pretty well, but since I use my ISP's SMTP server for outgoing, all of my e-mail clients have a rather funky asymmetric set-up. The e-mail setup wizards just don't handle it. At. All. As long as you remember how to do old-school e-mail config settings, and can convince the new-fangled e-mail client to let you do a manual config, the asymmetric server is not much of an issue.
For remote access, I port-forward IMAP in my firewall.
So I should probably modernize this whole kit, but.... I think I mentioned above that I am lazy.
Two real problems I have faced...I once (embarrassingly) created a unix user with test/test credentials for messing about and forgot that my postfix setup at the time reused unix credentials (ssh was locked down to only allow specific user to log in). I sent a few million spams a hour for a couple of weeks, getting my host into all the DNS blocklists. This took some time to fix (you have to apply to have your host removed from the blacklist). While I'm sure sending all that spam was annoying to many other people it didn't actually affect delivery for my mail...so it seems other administrators aren't using DNS blocklists?
Second, after a while I started to get a lot of spam. Maybe 10 per day. I tried various things to handle this, including setting up a proper bayesian spam filter (amavis-new) and using DNS blocklists myself. None of this worked for me. Greylisting however worked great.
So my suggestions to you: use defence in depth for mail as well as ssh. That means, fail2ban, different creds for both, unusual ports, user whitelists, high patchlevels (auto-patch and restart is great for a personal mail server) maybe client side TLS certs...etc. If you're relying on a single layer of defence eventually you'll make a mistake with it and then you're in trouble. I guess that really applies to anything you're trying to secure.
And they will continue to do so for as long as it takes for your mail server to earn a positive reputation. I recently had this problem with gmail after moving mail servers. there's really nobody that you can contact, gmail doesn't whitelist mail servers.
You're going to run into this problem with proofpoint, barracuda, postini, etc...
[0] https://www.linode.com/docs/email/postfix/email-with-postfix...
Setting up a working mail server is one of the biggest challenges because so many components are involved these days and you need to make them play perfectly together. I'm against using out of the box VM images / installers because then you don't understand whats going on under the hood. Mail servers are these kinds of beasts I would suggest to understand as best as possible before letting it loose on the world.
Its like with security. There is no "Just press this button/Just install this software and you are secure" solution - There is no easy and convenient way to run your own mail server without getting really involved with it :)
Just saying this as a warning for everybody who has this thought. I've been through it and my mail set up is running for 5 years like a charm now. But it was a steep way to get there :)
Be careful testing your configuration when sending emails to the large providers, you can inadvertently score negative marks against your own reputation, which is hard to recover from.
The reporting sets my mind at ease that those big guys are blocking it and that the (low) legitimate volume of mail to those guys is reasonable.
It's also interesting to note that with DNSSEC, DKIM, SPF and DMARC, the pattern seems to be that some large Chinese mail providers drop DNS responses to try to overcome the "-all" token in the SPF record and "p=reject" token in DMARC. At least the reports show that the authentication (by SPF/DKIM) failed, so that makes me sleep a little better.
Par for the course, I guess. :P
*edit: grammar
I have seen some people do cool things with qmail but unless you have a long history with it I think you are better off with postfix. Qmail requires a lot of patches to catch up with the way things are done these days.
It sounds like you have done all the best practice things. A valid PTR record, valid ssl certificate, SPF, DKIM, DMARC. You generally can't host from home anymore because your IP will likely be blacklisted so grab a vps and check your IP is clean. You will want to add ridiculous rate limiting so you don't get sin binned when someone mails to a group. Adding your IP to dnswl probably does not hurt.
Even with you doing everything else right it won't get you instant acceptance somewhere like hotmail. You are going to have to establish a reputation over time with them. Get an email address at all the free services, send emails, make as not spam, check their help websites. View full source of received emails if they let you to see what headers their mail system attached to your messages.
And ofcourse protect your reputation. If you need to send legitimate bulk email use someone like mailchimp and let them deal with any damage.
And this is only the outgoing part. You still have to worry about incoming emails, submission, retrieval, filtering etc.
I do email setups for websites where I need to ensure spam filter free communication with clients and most business mail system I encounter don't seem to bother with half the stuff I do. They will deliver all their emails plain text with no spf or dkim. And they will do brain dead things like having fake blackhole mx records as some sort of homeopathic spam remedy. And they all seem to stay in business so perhaps we just overthink this stuff sometimes.
The best way to give your outgoing mail 'authority' is to relay it through a smarthost. Some ISPs offer this - All my outgoing mail from the Exchange server in my Garage routes through my ISPs smarthost - it's the only way I can be sure that the big webmail hosts (hotmail/outlook, gmail, yahoo) actually get the mails. If I try to route direct, the mails get blocked.
I have a 50/10 connection from Comcast Business with five static IPs. One of those hosts what used to be a colo box with an ISP in Austin (I'd worked for them years ago, and had a services-for-colo agreement that lasted until an ownership change).
For about five years now I've had no problems sending or receiving mail; just keep a common-sense best practices configuration and do regular checks to make sure that you're not relaying/sending spam and aren't on any RBLs. "Nux"'s comment is a good list.
A long while ago, when I wasn't running the mail server in lxc, and it was a server which also hosted web frontends, I got it "hacked" once; a rouge perl script sent 10s of thousands of emails within an hours. Thankfully, this was in ~2007, so removing the node from blacklists wasn't impossible.
Anyway: add dmarc, and make sure you have TLS to send/receive. This latter is probably the most important bit.
http://flurdy.com/docs/postfix/
It'll take about three hours to get everything working right (and passing spam checks), but it's a great introduction to running your own mail server, and when you're done you can simply create an image of the machine to use in the future.
I made my own fresh Gmail account and messages go through fine. So I'd try that: make a fresh account from the one you've been testing with, and see if mail goes through.
I'm now considering something like a google organization account, or whatever it is called, where it's really gmail but with my domain name
My setup:
Debian Linux + Postfix + Dovecot + a little greylist milter I wrote myself in Python. Happy to release the code if there's any interest.
I also have a script that automates the process of setting up a mail server but it's not quite ready for prime time. If anyone is interested in being an early adopter let me know.
Depending on your upstream provider, though, it ranges from difficult to impossible to get the reverse DNS for "your" static IP addresses set to something reasonable. Maybe for a business account they would do it...but for a home connection, forget it. Trouble tickets asking for reverse DNS updates will be ignored.
I chose postfix which has a lot of off the shelf support for blacklisting and such, but even so I found that I couldn't stay ahead of spammers and their (new at the time) techniques like reflection attacks.
Anyway, while it's fun to play with this, unless you want to spend time every week keeping it up to date, etc., I found it mostly a drain on other better things I could be doing.
I remember fondly the days you could send an email to postmaster@domain.com and get a response from a real human being and at least attempt to have a rational conversation to resolve your mail delivery issues. I've tried that with google, yahoo, et al. and have never received a response.
I just use mailgun/mandrill/etc. these days and forget about it. I also pay $10 a year to a provider for my personal email address.
This is a little bit like "correlation is not causation". Companies are moving a lot of stuff to the 'cloud', and email is just one of the services that goes with it. It's simply cost-saving to not have dedicated IT personnel. Even if hosting your own mail server is easy, you need someone who takes care of it every now and then (disk full, adding users, blacklist incident once a year, etc.).
The internet seems to have decided that if your mail doesn't come from one of the major commercial mail brokers, it's as good as spam. I ran several private mail servers for several years before giving up. I'm generally suspicious of moving to cloud/services, but outgoing email is the one thing that I can safely say 99% of companies would be better off moving to a service.
Fun Fact: Microsoft Exchange has no native support for DKIM and tons of business run that in house, often on 'business class' connections without correct reverse IP records.
I don't know whether OP uses a home connection, but that makes a big difference. It has some pros and cons:
A VPS (with its dedicated IP address):
- Usually has a good reputation, though you might have bad luck. Switch early on when you notice this. Doing it later just nullifies any trouble you had building its reputation.
- Is hosted somewhere in the cloud. (I used to hate the term "the cloud" but it's actually pretty apt and funny if you start seeing it as "they have no idea where their shit is and who has access to it, both physically and network traffic".)
Hosting at home:
- Might be trouble with your ISP if you don't live in a country with net neutrality and port 25 is closed.
- Gets you a lower reputation score by default, so it takes slightly longer to build.
- Gives you full access control over your email.
If you're running from a VPS you may need a smarthost.
As a good netzien I should work to behave on IPv6, but it was just too much of a pita for my tiny, single user server which works fine on IPv4
For spam defence I use grey-listing based on DNSBL lookups, some standards-enforcement ACLs and then SpamAssasin via MailScanner on the messages that get through.
That said, SPF is worth looking into - but it's more a "good neighbour" thing. Rather than having any direct benefit for you, it helps other hosts spot mails that claim to be from you. "Be the change you want to see" type deal.
How long has the sender domain been registered?
How long has the sender domain been registered?
I trusted Microsoft once with my hotmail and they somehow deleted 16 years of my emails and correspondence with a few friends who passed away.
I run my own servers both onsite and in the cloud. I have my only little personal "corporate" network.
Why should anyone who has ever received an email from you know your IP address? Especially if it's a home server, that will give them some idea of where you live.
You need to also run spamassassin, with auto update, and check in with a number of rbl servers on the receiving side. (This is more important when you forward aliases to gmail and such)
Not really. They'll suspect them, especially ones that newly start sending email, but only very rarely block them.
My VM in the ISP has no issues, but from home, blocked at lots of places.
What you can do is use your ISP as a mail sending relay.
AWS throttle port 25. So for us to use that host as a relay server, we wouldn't be able to because of the throttle.
https://aws.amazon.com/premiumsupport/knowledge-center/ec2-p...
I'm sure if you're willing to put in the effort you can do it. But from my point of view, I'd probably just get a managed VPS with a hosting company who will take care of all the headaches of dealing with spam filters for me. They can be had pretty cheaply and the money is well worth it if you get good support.
Therefore I'd advise OP to keep at it, not just switch to a hosting company. Also for the learning experience, though that is secondary.
Or sometimes your IP will just get caught when a spam company decides to spam flag an entire block of IPs.
I think if OP keeps at it, they will find that it's not worth the hassle and for a very reasonable amount of money they could have just had a personal email server where someone else deals with the headaches.
Of course, again, I work for a hosting company so I may be biased here but I'd probably be saying the same thing even if I didn't.
These days you also have to get a bunch of different VPSs and test sending e-mails from their IPs and choose the ones working. That's what e-mail marketing companies do. Because a lot of IPs and subnetworks out there have poor reputation or even completely blacklisted and that reputation is not generally recoverable.
... and that, in turn, is why so many IPs have poor reputations.
It's like trying to make a toaster from scratch, or growing your own wheat to make your own bread. It's possible, but it's also impractical and you'll end up with a worse result than you can get off the shelf.