Simulate a black hole for a domain with Postfix
Software version | 2.10 |
Operating System | Debian 7 |
Website | Postfix Website |
Last Update | 07/05/2013 |
Introduction
When you manage outgoing emails through SMTP, you may sometimes need to test if a service is able to send correctly emails and itself check that there were no issue during sending. You can create a black hole for a specific domain and Postfix will answer from the same manner as if it is ok. It also permits to test Postfix sending capacities on a server.
Installation
Of course you need Postfix:
aptitude install postfix
Configuration
In the Postfix main configuration, add transport map line (/etc/postfix/main.cf
):
[...]
transport_maps = dbm:/etc/postfix/blackhole_map
[...]
Now add the fake domain to the transport map file (/etc/postfix/blackhole_map
):
blackhole.com discard:silently
Let’s generate the map now:
postmap -c /etc/postfix /etc/postfix/blackhole_map
Now restart postfix and you will see in your logs something like this:
postfix/discard[1435]: [ID 897546 mail.info] 4D847A5B: to=<john@blackhole.com>, relay=none, delay=13, delays=13/0/0/0, dsn=2.0.0, status=sent (silently)
References
http://www.memoire-partagee.fr/2011/01/smtp-sortant-faire-un-trou-noir-avec-postfix/
Last updated 07 May 2013, 05:54 CEST.