On 11/12/2010 12:40 PM, Mingliang Zu wrote:
Hi,

I'm using postfix 2.3. My intention is to reject "MAIL FROM" command (give a 501 syntax error) if the sender doesn't contains '@'.

Add reject_non_fqdn_sender to your restriction list.

"Reject a sender" is not the same as a syntax error; however, you can set the status returned by a match on a non-fqdn address or hostname: non_fqdn_reject_code = 501

But think why you would want to change it from the default first.

I have worked on it for two days but without any luck.

The following lines are added to main.cf <http://main.cf>. I was expecting "strict_rfc821_envelope" to do the trick, but unfortunately, it doesn't.

No, strict_rfc821_envelopes only deals with INVALID address formats, not non-fqdn ones. As long as the MTA can figure out what the sending domain is, a localpart-only address is not invalid, merely incomplete.

smtpd_sender_restrictions =
    permit_mynetworks,
    reject_non_fqdn_sender,
    reject_unknown_sender_domain,
    permit

This does not prevent clients in mynetworks from using malformed senders.


--
J.

Reply via email to