added example config for smtpd_sender_login_maps config
All checks were successful
/ build (push) Successful in 2m8s

This commit is contained in:
Christoph Haas 2026-08-01 20:07:41 +02:00
parent f4690f0490
commit 59fedb2489

View file

@ -267,14 +267,31 @@ That will work:
<~ 250 2.0.0 Ok: queued as AFFF12292A <~ 250 2.0.0 Ok: queued as AFFF12292A
``` ```
<Aside type="tip" title="Allow aliases?"> <Aside type="tip" title="Allow sending from an alias address?">
The setup so far works for personal mails from John. But if John would be a member of a distribution list The setup so far works for personal mails from John. But if John was a member
`pizza@example.org` then would not be able to use `pizza@example.org` as a sender address. of a distribution list `pizza@example.org` then he would not be able to use
`pizza@example.org` as a sender address.
If you want to allow that, create a new \*.cf file with a mapping query like this: If you want to allow that, add an SQL mapping for the `smtpd_sender_login_maps`
`SELECT email FROM virtual_users WHERE email='%s' UNION SELECT destination FROM virtual_aliases WHERE source='%s'`. as follows:
```sh title="Add an SQL mapping file"
cat > /etc/postfix/mariadb-sender-login-maps.cf <<EOF
user = mailserver
password = MAILSERVER-PASSWORD-HERE
hosts = 127.0.0.1
dbname = mailserver
query = SELECT email FROM virtual_users WHERE email='%s' UNION SELECT source FROM virtual_aliases WHERE destination='%s';
EOF
postconf smtpd_sender_login_maps=mysql:/etc/postfix/mariadb-sender-login-maps.cf
```
This SQL query will return…
- the email address of the current user
- all alias addresses that point to the current user
</Aside> </Aside>
<Aside type="danger" title="Check your $mydestination"> <Aside type="danger" title="Check your $mydestination">