]> git.ekhem.eu.org Git - server.git/commitdiff
[postfix] Deliver to addresses found in the address book.
authorJakub Czajka <jakub@ekhem.eu.org>
Mon, 1 May 2023 09:42:56 +0000 (11:42 +0200)
committerJakub Czajka <jakub@ekhem.eu.org>
Sun, 3 Dec 2023 17:00:57 +0000 (18:00 +0100)
`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.

postfix/domains.cf [new file with mode: 0644]
postfix/main.cf

diff --git a/postfix/domains.cf b/postfix/domains.cf
new file mode 100644 (file)
index 0000000..a3b27e6
--- /dev/null
@@ -0,0 +1,8 @@
+user = dovecot
+password =
+
+dbname = mail_db
+
+query = SELECT DISTINCT domain
+        FROM users
+        WHERE domain = '%s'
index d47f02c687ecc84d2f0d5a03c26c9ec3be7b7059..8981eae49f73f8a690944c097bbf33381f198d0a 100644 (file)
@@ -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