From: Jakub Czajka Date: Mon, 1 May 2023 09:42:56 +0000 (+0200) Subject: [postfix] Deliver to addresses found in the address book. X-Git-Url: https://git.ekhem.eu.org/?a=commitdiff_plain;h=61c34d10390d72c1091938205db8cf72a0313c0b;p=server.git [postfix] Deliver to addresses found in the address book. `postfix` relays to local mailbox only if the RCPT TO domain can be found in `$mydestination` and RCPT TO address can be found in `$alias_maps`. This commit sets these variables to query the address book. --- diff --git a/postfix/domains.cf b/postfix/domains.cf new file mode 100644 index 0000000..a3b27e6 --- /dev/null +++ b/postfix/domains.cf @@ -0,0 +1,8 @@ +user = dovecot +password = + +dbname = mail_db + +query = SELECT DISTINCT domain + FROM users + WHERE domain = '%s' diff --git a/postfix/main.cf b/postfix/main.cf index d47f02c..8981eae 100644 --- a/postfix/main.cf +++ b/postfix/main.cf @@ -25,6 +25,12 @@ smtpd_tls_key_file = ${mail_ssl_cert_dir}/privkey.pem smtpd_tls_mandatory_ciphers = high smtpd_tls_security_level = encrypt +# SMTPd +## Domain names of local (no forward) recipients. +mydestination = pgsql:/etc/postfix/domains.cf +## Addresses of local recipients. +alias_maps = pgsql:/etc/postfix/address_book.cf +## Deliver to dovecot. mailbox_transport = lmtp:unix:private/dovecot-lmtp # Message rewrite