Simulate a black hole for a domain with Postfix

From / Bloc Notes Informatique
Jump to: navigation, search

Software version 2.10
Operating System Debian 7
Website Postfix Website
Last Update 07/05/2013

1 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 permit to test Postfix sending capacities on a server.

2 Installation

Of course you need Postfix :

aptitude install postfix

3 Configuration

In the Postfix main configuration, add transport map line :

Configuration File /etc/postfix/
transport_maps = dbm:/etc/postfix/blackhole_map

Now add the fake domain to the transport map file :

Configuration File /etc/postfix/blackhole_map     discard:silently

Let's generate the map now :

Command postmap
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] 4D847A5B: to=<>, relay=none, delay=13, delays=13/0/0/0, dsn=2.0.0, status=sent (silently)

4 References