Thursday, June 11, 2009

Postfix Sink

I'm not too familiar with postfix but recently I needed an SMTP server that would catch all mail (act as an open relay) and deliver none.

I did this in Ubuntu Jaunty with the following two lines added to /etc/postfix/main.cf:
relay_domains = mydomain.com # accept all mail destined for mydomain.com
defer_transports = smtp # don't deliver anything that comes in via SMTP

Strictly speaking this isn't an open relay (we only relay to one domain). There's more restrictions around relaying as described in The Book of Postfix.

From here you can view the queue using postqueue -p, dump the contents of a message using postcat -q [id] > file.mail and then finally delete the message using sudo postsuper -d [id]