Skip to content

Instantly share code, notes, and snippets.

@evilchili
Last active October 12, 2018 23:50
Show Gist options
  • Save evilchili/3795853 to your computer and use it in GitHub Desktop.
Save evilchili/3795853 to your computer and use it in GitHub Desktop.
blackhole all mail except for one domain using postfix
# define a transport for mail you want to deliver
echo "$VALID_DOMAIN smtp:[$VALID_RELAYHOST]" > /etc/postfix/transport
postconf -e transport_maps = hash:/etc/postfix/transport
# everything else goes to a bogus relayhost, which causes a bounce
postconf -e relayhost = 169.254.0.0
# immediately throw away all bounces
postconf -e maximal_queue_lifetime = 0
postconf -e bounce_queue_lifetime = 0
# optionally record all blackholed mail to a specific address
# postconf -e always_bcc = blackhole@$VALID_DOMAIN
# time for Jell-O(tm)
postmap /etc/postfix/transport
postfix reload
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment