dannyman.toldme.com


Technical

HOWTO: Postfix Drops Outbound External Mail

While testing an application, a user requested that I configure the mail server to only deliver to addresses within our company, but drop all mail sent outside. (We don’t want to accidentally bother customers.)

I was a little frustrated by this problem, but now I have a solution. The trick is to set up a transport map that leaves mail destined for our local domain as-is, but then drops everything else.

First, set up a transport file:

# cat transport
mydomain.com      :
.mydomain.com     :
*          discard:

Map it:

# postmap transport

Configure transport_maps in main.cf:

transport_maps = hash:/path/to/transport

Reload Postfix and send test messages. The discard service successfully “delivers” messages straight to the trash, like so:
Sep 15 14:55:10 myhost postfix/discard[16189]: 6F0A22E04E: to=<dannyman@toldme.com>, relay=none, delay=0, status=sent (toldme.com)

Read More

Next:
Previous:
Categories: Technical

Discover more from dannyman.toldme.com

Subscribe now to keep reading and get access to the full archive.

Continue reading