![当外部域发送电子邮件时,Postfix 不应用虚拟邮箱规则](https://linux22.com/image/651489/%E5%BD%93%E5%A4%96%E9%83%A8%E5%9F%9F%E5%8F%91%E9%80%81%E7%94%B5%E5%AD%90%E9%82%AE%E4%BB%B6%E6%97%B6%EF%BC%8CPostfix%20%E4%B8%8D%E5%BA%94%E7%94%A8%E8%99%9A%E6%8B%9F%E9%82%AE%E7%AE%B1%E8%A7%84%E5%88%99.png)
我设置了 Postfix 以使用虚拟邮箱。当我远程登录邮件服务器并从中发送电子邮件时,它运行完美(无论是在邮件服务器上还是从远程客户端远程登录时)。邮件文件位于“new”下的指定目录中。
但是如果我从外部发送电子邮件,不使用 Telnet,则邮件将以/var/mail/
文件recipient
(例如 xyxl)的形式进入内部,理论上包含发送给该收件人的所有电子邮件,而不是以/var/mail/vmail/xyxl/new
仅包含一封电子邮件的文件的形式进入所需目录。
这可能与权限问题有关吗?我设置了 /var/mail/vmail 以拥有所有者 vmail 和组所有者 vmail,它们的 uid=5000 和 gid=5000。我这样做只是因为我多次看到这样做,并认为这没问题。也许 postfix 默认为而/var/mail
不是/var/mail/vmail
因为它没有权限?但我读到 postfix 在接收邮件时登录收件人帐户并以该用户身份写入电子邮件文件。收件人xyxl
是 vmail 组的一部分。但为什么它可以通过 telnet 工作,而不是通过普通电子邮件工作......
我的设置没有什么特别的,整个本地网络中只有一个 Postfix 充当网关(如果这是错误的术语,则没有发生中继)。
Postfix 显然接受了该电子邮件,但我无论如何都会附上日志。
输出postconf -n
append_dot_mydomain = no
biff = no
config_directory = /etc/postfix
inet_interfaces = all
inet_protocols = ipv4
mailbox_size_limit = 0
mydestination = $mydomain, localhost.localdomain, localhost
mydomain = mail.example.net
myhostname = foobar
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
myorigin = mail.example.net
readme_directory = no
recipient_delimiter = +
relayhost =
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
smtpd_recipient_limit = 5
smtpd_tls_cert_file = /etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file = /etc/ssl/private/ssl-cert-snakeoil.key
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtpd_use_tls = yes
virtual_gid_maps = static:5000
virtual_mailbox_base = /var/mail/vmail
virtual_mailbox_domains = example.net
virtual_mailbox_maps = hash:/etc/postfix/vmailbox
virtual_minimum_uid = 100
virtual_uid_maps = static:5000
我的 /etc/postfix/vmailbox
[email protected] example.net/xyxl/
postfix.log 发送至[email protected]
Feb 7 00:42:16 foobar postfix/smtpd[14942]: warning: dict_nis_init: NIS domain name not set - NIS lookups disabled
Feb 7 00:42:16 foobar postfix/smtpd[14942]: connect from mail-wg0-f46.google.com[74.125.82.46]
Feb 7 00:42:16 foobar postfix/smtpd[14942]: 3A4C6BFDC2: client=mail-wg0-f46.google.com[74.125.82.46]
Feb 7 00:42:16 foobar postfix/cleanup[14945]: 3A4C6BFDC2: message-id=<[email protected]>
Feb 7 00:42:16 foobar postfix/qmgr[13866]: 3A4C6BFDC2: from=<[email protected]>, size=1848, nrcpt=1 (queue active)
Feb 7 00:42:16 foobar postfix/local[14946]: warning: dict_nis_init: NIS domain name not set - NIS lookups disabled
Feb 7 00:42:16 foobar postfix/smtpd[14942]: disconnect from mail-wg0-f46.google.com[74.125.82.46]
Feb 7 00:42:16 foobar postfix/local[14946]: 3A4C6BFDC2: to=<[email protected]>, relay=local, delay=0.14, delays=0.1/0/0/0.04, dsn=2.0.0, status=sent (delivered to mailbox)
Feb 7 00:42:16 foobar postfix/qmgr[13866]: 3A4C6BFDC2: removed
postfix.log 发送至[email protected]
Feb 7 01:43:52 NSFW postfix/smtpd[17722]: warning: dict_nis_init: NIS domain name not set - NIS lookups disabled
Feb 7 01:43:52 NSFW postfix/smtpd[17722]: connect from mail-we0-f180.google.com[74.125.82.180]
Feb 7 01:43:52 NSFW postfix/smtpd[17722]: E623EBFDC5: client=mail-we0-f180.google.com[74.125.82.180]
Feb 7 01:43:52 NSFW postfix/cleanup[17726]: E623EBFDC5: message-id=<[email protected]>
Feb 7 01:43:53 NSFW postfix/qmgr[13866]: E623EBFDC5: from=<[email protected]>, size=1832, nrcpt=1 (queue active)
Feb 7 01:43:53 NSFW postfix/local[17727]: warning: dict_nis_init: NIS domain name not set - NIS lookups disabled
Feb 7 01:43:53 NSFW postfix/smtpd[17722]: disconnect from mail-we0-f180.google.com[74.125.82.180]
Feb 7 01:43:53 NSFW postfix/local[17727]: E623EBFDC5: to=<[email protected]>, relay=local, delay=0.13, delays=0.09/0.01/0/0.03, dsn=2.0.0, status=sent (delivered to mailbox)
Feb 7 01:43:53 NSFW postfix/qmgr[13866]: E623EBFDC5: removed
答案1
我只是重复一下 daff 所说的话:
您的日志行说的是实话。发件人发送了带有收件人地址的电子邮件[email protected]
。
除非你能证明发件人与收件人共同撰写了电子邮件,[email protected]
并且谷歌神奇地将其转换为[email protected]
,否则这里无能为力。这是客户的错,不是你的服务器故障。