Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

TL;DR: can I DISCARD outgoing mail to a specific server by DNS name of the MX record , or failing that, by its IP?

We've some 'trouble' (well, more of an annoyance really), of people filling out some random keyboard strokes as e-mail address. Suprise surprise: most of those @hjk.tld & @asdf.tld domains are parked domains for sale. Generally, per tld, there are only 1 to 3 players having claimed the bulk of these domains. Usually, they've configured the same MX record for those domains, but are either not listening on it or denying sending any e-mail on it.

Those e-mails just hang there in the queue, will never be delivered, and bounce back after a the final time-out. That server has better things to do, so I'd like to discard those e-mails immediately. I could list every single one of those domains in a blacklist, but (a) that would mean that when the domain actually is sold / becomes active, mail is discarded unjustly and (b) maintaining that list is a pain.

What I would very much like, is a way in Postfix to list any mail for which the mx server is 'some-mx.somedomainparker.tld' as a reason to discard the mail at the first possible point. If it can't be done based on DNS name, perhaps based on its IP. I can't seem to find anything like that in de docs. Of course, I could just drop traffic to the specific IP, keeping resources used to a minimum, but I'd like to keep my queues as clean as possible.

share|improve this question

You can either use a bespoke script of your own involving mailq pipes, sed ,awk and postsuper. Or you can install and use pfqueue, which will allow you to tag mails for further actions, like delete or hold.

share|improve this answer
Yes, I'm currently working with mailq/postsuper combo as a temporary measure, and this works ok-ish, but constantly scanning the queue with cron jobs is what I'd like to avoid. pfqueue seems as first glance to only be an interactive thing. which is nice to manually throw some away, but I'd very much keep it a hands-off kind of thing ;) Or am I mistaken reading the pfqueue man? – Wrikken Feb 11 '14 at 19:06
No you're not mistakeing, it is an interactive tool, I don't remember I used it in batch mode. All in all, if you have to clean your queue on a regular basis, then you have have a configuration problem, and the thing to fix is how not to get those mails in the mailq ;) – alxgomz Feb 12 '14 at 13:45
Yes, indeed, which is what I was after, with DISCARD-ing them on the spot... It wouldn't be that much needed if those domain-parking dudes just refused the mail, but they refuse to listen to SMTP on their configured MX. – Wrikken Feb 12 '14 at 14:55

I understand what you're trying to do, but honestly, it's an irresponsible course of action for a mail system administrator. What happens when those MXes start accepting mail for a domain your users are trying to email? Their messages will be silently dropped. Not a good outcome.

Instead of discarding the messages, why not just shorten the queue/retry period on these messages? That will keep your queues cleaner than before, without completely breaking how email delivery is supposed to work (and how users expect it to work).

share|improve this answer
Sure, let's say 2 hours, how can I add the rules for that MX (so, not for a domain, for specifically for a receiving MX)? – Wrikken Feb 11 '14 at 13:40
@Wrikken - Sorry, I don't know enough about postfix to recommend how you would actually do this. – EEAA Feb 11 '14 at 17:15

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.