We basically want to avoid sending several emails to destination email addresses that have already been bounced.

I have a list in a database (currently sqlite, and also a flat file) of banned email address, namely addresses that have been previously bounced.

I would like to configure postfix to reject target that are present in that list. namely, I would like postfix to REJECT the email during 'RCPT TO' so that when smtp client tries to send to those destinations, they receive error directly. said diffently, I basically want the SMTP client to receive an error when he tries to target those email adresses.

I tried that solution here with usage of usage de smtpd_recipient_restrictions:

Block outgoing mail to specific address using Postfix - Server Fault Block outgoing mail to specific address using Postfix

But it seems to still contact the destination MX server. And the result is that Postifx still accept bad recipients (tried with PHPmailer).

Googling around, there also this post which could be relevant: postfix check_recipient_access syntax https://www.experts-exchange.com/questions/26889940/postfix-check-recipient-access-syntax.html

version : Postix 2.9.6-2

  • Did you try the other solutions given in that post? – Michael Hampton Nov 9 '18 at 15:12
  • I did not try the solution with transport_maps. I will RTFM then check this. – Nadir Nov 9 '18 at 16:12
  • I just tried. Same issue: target server is accessed, and the SMTP client receives "Accepted" on 'RCPT TO' – Nadir Nov 9 '18 at 16:30

The methodology using smtpd_recipient_restrictions (described in the above link) actually works, it was just a matter of directive order.

Order matters within the options!

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.