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
Possibly-Related Posts

Response

May 11th, 2012

Wallander Kurt

I was looking exactly for this. Thanks for the crisp info.

Comment

Leave a comment . . .

Tiny Print:

  1. For private messages, e-mail me: dannyman@toldme.com.
  2. You must provide an e-mail address.
  3. You can use a bogus e-mail address, but I like to know who you are.
  4. I will not spam you. I will not publish or share your e-mail address.
  5. First-time commenters will be held for review.
  6. You can use these HTML tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>