My postfix e-mail server is finally working well.
Now, I need to prevent users from forging their e-mail addresses in the client programs in the "from" field in the header, because a user can send email as other user with that, and a unexperienced user can think that is real.
If a user is experienced, he can inspect the email headers and know what is happening, but is there a way to block this behaviour?
Best Answer
Have a look at the
smtpd_sender_restrictions
andsmtpd_sender_login_maps
settings. The former can prevent malformedfrom
addresses, while the latter can force the sender address to match the login name.The contents of
login_maps.pcre
could beThe above config assumes that postfix was compiled with support for PCRE. On Ubuntu/Debian, this requires the
postfix-pcre
package to be installed.Note that this will only work if nobody but authenticated users can send mail. If you allow mail from unauthenticated users, the above method won't help and will fail. Make sure to read Rui F Ribeiro's answer if that's the case.