Postfix login mismatch sender address rejected

I changed the query variable in 'mysql-virtual-mailbox-maps.cf'

from: query = SELECT 1 FROM virtual_users WHERE email='%s'

to: query = SELECT email FROM virtual_users WHERE email='%s'.

It didn't work before because it needs to match the 'FROM' header to the return value of the query (reject_sender_login_mismatch) explains this.


Replace reject_sender_login_mismatch with reject_authenticated_sender_login_mismatch will do the trick.

Explanation

In postfix main.cf, parameter reject_sender_login_mismatch was an alias for reject_authenticated_sender_login_mismatch, reject_unauthenticated_sender_login_mismatch.

The reason why outside network can't send email is reject_unauthenticated_sender_login_mismatch (which is parts of reject_sender_login_mismatch) will rejects sender which isn't defined in smtpd_sender_login_maps.

For further explanation of this three parameter, I suggest to take a look in this discussion.