Skip to main content
The 2024 Developer Survey results are live! See the results

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

7
  • you need to block the address you are trying to send to or receive from? Sorry, a little bit not clear. Commented Aug 27, 2013 at 15:39
  • @DanilaLadner it's an external email address, a sender that is not me. Commented Aug 27, 2013 at 15:42
  • Right, so that external email is sending you emails you want to block for your users? Commented Aug 27, 2013 at 15:51
  • 5
    In my experience the smtpd_sender_restrictions only affects mail based on return path, not MAIL FROM header as it says in the docs. Not sure if this is a bug or what. I tried spoofing an email to my server that should have been rejected by setting from in the header and it had no effect. When i added the -f flag to sendmail to specify return path it successfully rejected my email. Commented Mar 4, 2015 at 17:43
  • 1
    @billynoah how correct you are. took me several hours to figure this out. Put simply, smtpd_sender_restrictions will only block mail based on its Return-Path header NOT its From header. So if your smtpd_sender_restrictions hash:/etc/postfix/block contains [email protected] REJECT mail with From: [email protected] will NOT be rejected; rather, only mail with Return-Path: [email protected] will be blocked (!!) Arrrrgh.
    – user7835
    Commented May 5, 2016 at 18:32