具有多个条目的 Postfix Maildir virtual_mailbox_maps 和 virtual_alias_maps

具有多个条目的 Postfix Maildir virtual_mailbox_maps 和 virtual_alias_maps

使用 Ubuntu 16.04 Xenial / Postfix 3.1.0 我已经设置虚拟邮箱映射虚拟别名映射使用邮箱目录我需要 Postfix 将邮件同时发送到外部电子邮件地址和相应的 Maildir 文件夹。相反,尽管我尽了最大努力,Postfix 还是选择了第一个匹配/出现。它要么将邮件发送到别名,要么将邮件发送到 Maildir。我无法将其配置为同时执行这两项操作。

这个问题的第二部分是,我还需要将一个虚拟邮箱转发到多个 Maildir 位置。例如,我需要将邮件发送到[电子邮件保护]将邮件存储在 /home/vmail/mydomain.com/admin/ 和 /home/vmail/mydomain.com/backup/ 中(除了转发到外部电子邮件地址[电子邮件保护]如上所述)。

尝试这样做会导致在第一个 Maildir 中创建一个子目录,其名称与第二个 Maildir 相同,并将收到的邮件存储在那里。我尝试使用空格、制表符、逗号和加号分隔条目。每次尝试都得到相同的结果,即在 /vmail/domain.com/user/ 文件夹中创建一个子目录。每次更改后,我都会使用 postmap 并重新加载 Postfix。

我也尝试为单个地址添加多行,但 Postfix 会读取第一个匹配项并发出有关重复的警告。

虚拟邮箱映射// 我尝试使用空格分隔,如下所示:

[email protected]    mydomain.com/admin/   mydomain.com/backup/

注意,上述格式适用于虚拟别名映射,转发至多个外部电子邮件地址。

我搜索了互联网上能找到的所有资源,尝试了各种不同的配置。我当前的 main.cf 配置如下。我暂时注释掉了 virtual_alias_maps 以保持 Maildir 配置的功能(别名似乎总是优先)。

非常感谢任何建议或帮助。如果需要更多信息,请告诉我。

smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
biff = no

# appending .domain is the MUA's job.
append_dot_mydomain = no

# Uncomment the next line to generate "delayed mail" warnings
delay_warning_time = 4h
readme_directory = no

# See http://www.postfix.org/COMPATIBILITY_README.html -- default to 2 on
# fresh installs.
compatibility_level = 2

# Network settings
myhostname = server.mydomain.com
mydomain = mydomain.com
myorigin = $mydomain
mydestination = localhost
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
inet_protocols = ipv4
mynetworks_style = subnet

# Mail settings
#mailbox_command = /usr/bin/procmail
#mailbox_base = /home/vmail
#mailbox_owner = vmail
home_mailbox = Maildir/
recipient_delimiter = +
#alias_maps = hash:/etc/aliases
#alias_database = hash:/etc/aliases

# Limits
message_size_limit = 20480000
mailbox_size_limit = 1073741824

# Virtual Mailbox settings
virtual_mailbox_domains = /etc/postfix/virtual_domains
virtual_mailbox_base = /home/vmail
virtual_mailbox_maps = hash:/etc/postfix/virtual_mailbox
virtual_minimum_uid = 1000
virtual_uid_maps = static:5000
virtual_gid_maps = static:5000

# Virtual Alias settings
#virtual_alias_domains = /etc/postfix/valias
#virtual_alias_maps = hash:/etc/postfix/virtual_forwarding

# TLS parameters
smtpd_tls_cert_file = /etc/letsencrypt/live/mydomain.com/fullchain.pem
smtpd_tls_key_file = /etc/letsencrypt/live/mydomain.com/privkey.pem
smtpd_use_tls=yes
smtpd_tls_auth_only = yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache

#Disable Poodle
smtpd_tls_security_level = may
smtp_tls_security_level = may
smtp_tls_loglevel = 1
smtpd_tls_loglevel = 1
smtpd_tls_mandatory_protocols=!SSLv2,!SSLv3
smtp_tls_mandatory_protocols=!SSLv2,!SSLv3
smtpd_tls_protocols=!SSLv2,!SSLv3
smtp_tls_protocols=!SSLv2,!SSLv3

# Changes to SSL Ciphers
tls_preempt_cipherlist=yes
smtpd_tls_mandatory_ciphers=high
tls_high_cipherlist=ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA:ECDHE-ECDSA-DES-CBC3-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:DES-CBC3-SHA:!DSS
#tls_high_cipherlist=ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:DHE-DSS-AES256-GCM-SHA384:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA256:ADH-AES256-GCM-SHA384:ADH-AES256-SHA256:ECDH-RSA-AES256-GCM-SHA384:ECDH-ECDSA-AES256-GCM-SHA384:ECDH-RSA-AES256-SHA384:ECDH-ECDSA-AES256-SHA384:AES256-GCM-SHA384:AES256-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:DHE-DSS-AES128-GCM-SHA256:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES128-SHA256:DHE-DSS-AES128-SHA256:ADH-AES128-GCM-SHA256:ADH-AES128-SHA256:ECDH-RSA-AES128-GCM-SHA256:ECDH-ECDSA-AES128-GCM-SHA256:ECDH-RSA-AES128-SHA256:ECDH-ECDSA-AES128-SHA256:AES128-GCM-SHA256:AES128-SHA256:NULL-SHA256

# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.

# SMTPD Settings
smtp_sasl_auth_enable = no
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
smtpd_recipient_restrictions = permit_auth_destination,permit_sasl_authenticated,permit_mynetworks,reject_unauth_destination
smtpd_relay_restrictions = permit_mynetworks,permit_sasl_authenticated,defer_unauth_destination,permit_inet_interfaces
smtpd_sasl_local_domain = $myhostname
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth

# Custom settings
allow_percent_hack = no
append_at_myorigin = no

答案1

看起来 virtual_alias_maps 可能就是答案。

您只需要在 virtual_alias_maps 中像这样指定它:

[email protected] [email protected], [email protected]

当然,你应该[电子邮件保护]在 virtual_mailbox_maps 中。

我在这里找到了答案(示例 2):https://workaround.org/ispmail/jessie/types-of-email-domains

相关内容