Blackholing emails that shouldn't be sent any further

From MyWiki

Jump to: navigation, search

Reference:

Thanks to the article [1] referenced above, I finally managed to get it working.

We have some test suits that result in a storm of emails to the likes of null@test.com or none@dummy.com, which I didn't want to go anywhere past the internal SMTP gateway. First I was trying to get it working as described in [2], but for some strange reason it didn't work for me. Was getting:

Apr 17 19:24:54 smtp-02 postfix/smtp[1546]: E0669823FD: to=<blackhole@localhost>, orig_to=<alex@test.com>, relay=10.8.100.26[10.8.100.26]:25, delay=0.04, delays=0.02/0/0/0.01, dsn=5.1.1, status=bounced (host 10.8.100.26[10.8.100.26] said: 550 5.1.1 <blackhole@localhost>: Recipient address rejected: User unknown in local recipient table (in reply to RCPT TO command))

Even though I do have localhost in $mydestination and "alias_maps = hash:/etc/aliases" is there too. Must be too late and too tired problem.

Also, tried smtpd_recipient_restrictions with check_recipient_access and DISCARD action for the two domains (test.com and dummy.com) - no luck.

So, what I did was to do the same as in [1] - used transport map and added the two lines to my transport map:

test.com	discard:down to the rabbit hole
dummy.com	discard:down to the rabbit hole

And the magic happened:

Apr 17 21:54:02 ie1-prod-smtp-02 postfix/discard[19099]: A3904801AC: to=<null09545@test.com>, relay=none, delay=18, delays=18/0.01/0/0, dsn=2.0.0, status=sent (down to the rabbit hole)

And no sign of the email in upstream SMTP gateway :-)

Happy days!

Personal tools