![Postfix 和 PostgreSQL:如何使相同的别名适用于不同的域?](https://linux22.com/image/679022/Postfix%20%E5%92%8C%20PostgreSQL%EF%BC%9A%E5%A6%82%E4%BD%95%E4%BD%BF%E7%9B%B8%E5%90%8C%E7%9A%84%E5%88%AB%E5%90%8D%E9%80%82%E7%94%A8%E4%BA%8E%E4%B8%8D%E5%90%8C%E7%9A%84%E5%9F%9F%EF%BC%9F.png)
我目前有三个域名。我想为每个域名设置(大部分)相同的别名,并在 Thunderbird 上检索邮件。它已经可以发送/接收 和 的邮件[email protected]
,[email protected]
但[email protected]
现在我需要一些别名。
如果我发送邮件[电子邮件保护]到其中一个别名地址(见下文),邮件返回错误:Recipient address rejected: User unknown in local recipient table
。
我也不明白为什么 /etc/aliases 仍然有效。我不想使用它,因为它无法处理不同域上的相同别名。
而且我已经尝试改成alias_maps
,virtual_alias_maps
但是没有效果。
以下别名/邮件应将其邮件转发至 contact@domain1.com
以下别名/邮件应将其邮件转发至 contact@domain2.net
以下别名/邮件应将其邮件转发至 contact@domain3.de
/etc/postfix/main.cf
myhostame = domain1.com
myorigin = domain1.com
mydestination = domain1.com domain2.net domain3.de localhost localhost.localdomain
relayhost =
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
alias_maps = hash:/etc/aliases proxy:pgsql:/etc/postfix/pgsql-aliases.cf
local_recipient_maps = proxy:pgsql:/etc/postfix/pgsql-boxes.cf $alias_maps
mailbox_transport = lmtp:unix:private/dovecot-lmtp
smtpd_tls_cert_file=/etc/letsencrypt/live/domain1.com/fullchain.pem
smtpd_tls_key_file=/etc/letsencrypt/live/domain1.com/privkey.pem
smtpd_use_tls=yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_tls_security_level=may
smtpd_tls_protocols = !SSLv2, !SSLv3
PostgreSQL 表
mail=> table aliases;
alias | email
--------------------------+----------------------
[email protected] | [email protected]
[email protected] | [email protected]
[email protected] | [email protected]
[email protected] | [email protected]
[email protected] | [email protected]
[email protected] | [email protected]
[email protected] | [email protected]
[email protected] | [email protected]
[email protected] | [email protected]
/etc/postfix/pgsql-aliases.cf
user=mailreader
dbname=mail
table=aliases
select_field=alias
where_field=email
hosts=unix:/var/run/postgresql