On 19/06/24 18:51, Tan Mientras via Postfix-users wrote:
Hi

*Trying to setup email REJECT when users try to send to a no-reply email.*

There is no such thing as a no-reply email, there is no part of the email specification that allows a message to be marked as unable to be replied to. Many people think they can send a no-reply message by setting the localpart of the From: header to "no-reply" "noreply" or similar but this is not part of any official specification, nor does it prevent someone from replying to that email address.

All that is said because no-re...@example.com could be a perfectly valid email address fully capable of accepting messages, and as such you might want to re-think your policy of blocking messages to such addresses. Note that if the mailbox is truly invalid then the receiving MX should issue an appropriate rejection which your server can then pass back to the user in the form of a DSN (bounce message).

AFAIK, this should be configuren on smtpd_recipient_restrictions using check_recipient_access. Please, let me know if I'm wrong.

Yes that can be used to reject messages to recipients that match a certain pattern in the recipient's address, one such pattern being any address with a local part of "noreply".

It's not working, so maybe it's because I don't know if rules are applied on first match or combined (ie: if a reject is found, is immediately rejected or it might be permited by another rule).

Rules are checked in the order they are encountered with the first permit or reject stopping the checks of that particular restrictions.

This is /approximately/ my configuration:

smtpd_recipient_restrictions =
     check_recipient_access ldap:ext2int, #allows any ldap account

If this returns OK or permit then the following rule will not be checked.

    check_recipient_access hash:/etc/postfix/no-reply_reject, #reject no-reply

What this does will depend on the content of /etc/postfix/no-reply_reject (which you did not show).

     reject_authenticated_sender_login_mismatch,
     permit_sasl_authenticated,

This will stop processing if the user is authenticated and permit the message.

     reject_unauth_destination,

This rule is redundant, because it can only either reject or fall down to the next rule

     reject

...which will always reject, so the last two rules will always reject regardless.


Peter
_______________________________________________
Postfix-users mailing list -- postfix-users@postfix.org
To unsubscribe send an email to postfix-users-le...@postfix.org

Reply via email to