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?
You can do this using virtual mailboxes. Instead of the usual lookup maps, you'd have a PCRE table that looks like this:
to return the username
spamuser
regardless of what email address is the recipient.In your postfix.conf you'd have the line
There's more information about both virtual alias maps and PCRE tables at postfix.org
Here is how I done it
create user webmail
I had to install the postfix-pcre package. Code:
I created a file called /etc/postfix/virtual as follows:-
Code:
edited
/etc/postfix/main.cf
to add this line:For the absolute newbies (like me), if the configuration is correct, the query command: Code:
would return the email id specified in virtual file (/etc/postfix/virtual). In this case. Code:
To test the working, use the mail command from the terminal. Code:
enter the subject, mail body and press Ctrl+D (to exit the compose window).
To view the message use the following command. (webmail is the mail id configured in virtual file. Substitute with your name.) Code:
PS:To check the mail log use the following command. Code:
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: http://www.postfix.org/smtp-sink.1.html
It's basically a load tester (accept then discard), but you can also configure it to accept then store.