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

I need to configure an SMTP server to accept any email to any address that might happen to reach it on port 25 and deliver it to a local mailbox (i.e. a spam sinkhole)

The default supported MTA on my O/S is Postfix, of which I have no experience. I used to do a lot of Sendmail and Exim, but that was years ago.

Can this be done with Postfix?

share|improve this question
up vote 6 down vote accepted

You can do this using virtual mailboxes. Instead of the usual lookup maps, you'd have a PCRE table that looks like this:

/.*/ spamuser

to return the username spamuser regardless of what email address is the recipient.

In your postfix.conf you'd have the line

virtual_alias_maps = pcre:/etc/postfix/virtual

There's more information about both virtual alias maps and PCRE tables at

share|improve this answer
thanks - seems to work fine! I expected that a PCRE map would do it, but the hint I needed was using pcre: for the map file. – Alnitak Jun 10 '13 at 15:01
I'm glad it worked! – Jenny D Jun 10 '13 at 20:12

If you want to make postfix into an open proxy that will accept mail for any domain, you may want to look into this piece of code:

It's basically a load tester (accept then discard), but you can also configure it to accept then store.

share|improve this answer
I need it to catch all domains, not be configured with a list. – Alnitak Jun 10 '13 at 13:41
Well, that sort of counters the way postfix was designed, and the way mail works (domains need to be configured in postfix, and have an MX record pointing to it), unless you want to create an open relay that doesn't actually forward. Which is possible, AFAIK. – NickW Jun 10 '13 at 13:42
Yes, an open relay that doesn't relay (and then redirects to a local mailbox) would achieve what I need. – Alnitak Jun 10 '13 at 13:47

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.