I have set up a Postfix server with SMTP AUTH (STARTTLS on port 587). All my users are in the domain "example.org". I want to enforce the sender address to be "logged-in-user@example.org".
I learned that this can be achieved with the main.cf options
smtpd_sender_restrictions = reject_sender_login_mismatch, ...
smtpd_sender_login_maps = hash:/etc/postfix/smtpd_sender_login_maps
with a login_maps file like:
a@example.org a
b@example.org b
c@example.org c
...
(see also Block sender address spoofing with SMPT AUTH), but this would mean I'll have to edit the login_maps file every time I have a new user. I don't need such a flexible mapping: It should always be "logged-in-user@example.org". Is there an easier option?
Best Answer
First, check whether your installation of Postfix supports pcre by entering the command
postconf -m
and looking for a line withpcre
in it. Once you have verified that you have pcre support, you can do as follows:/etc/postfix/login_maps.pcre
:In
main.cf
:This should work fine.