我无法使用 Postfix 从我的服务器发送电子邮件。/var/log/mail.log
出现以下情况:
postfix/local[1803]: 59367CDB9: to=<[email protected]>, orig_to=<opendkim>, relay=local, delay=0.03, delays=0.02/0/0/0, dsn=5.2.0, status=bounced (maildir delivery failed: create maildir file /run/opendkim/Maildir/tmp/1704452581.P1803.example.com: Permission denied)
postfix/bounce[1805]: 59367CDB9: sender non-delivery notification: 5BD0ECDB3
postfix/qmgr[1731]: 59367CDB9: removed
postfix/qmgr[1731]: 5BD0ECDB3: from=<>, size=2835, nrcpt=1 (queue active)
postfix/local[2352]: warning: maildir access problem for UID/GID=114/120: create maildir file /run/opendkim/Maildr/tmp/1704452581.P2352.example.com: Permission denied
postfix/local[2352]: warning: perhaps you need to create the maildirs in advance
postfix/local[2352]: 5BD0ECDB3: to=<[email protected]>, relay=local, delay=0.01, delays=0.01/0/0/0, dsn=5.2.0, status=bounced (maildir delivery failed: create maildir file /run/opendkim/Maildir/tmp/1704452581.P2352.example.com: Permission denied)
postfix/qmgr[1731]: 5BD0ECDB3: removed
为了进一步思考,我尝试在我的服务器上运行 Dovecot + OpenDKIM + Postfix。经过一段时间的折腾,ISP 承认端口 25 确实被过滤了,因此我清除了 Dovecot 和 OpenDKIM,并重新安装了 Postfix。然而,即使清除后,仍然/var/log/mail.log
显示有东西在向用户发送邮件opendkim
。
postconf -n
显示:
alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
append_dot_mydomain = no
biff = no
compatibility_level = 3.6
home_mailbox = Maildir/
inet_interfaces = all
inet_protocols = all
mailbox_size_limit = 0
mydestination = $myhostname, example.com, mail.example.com, localhost.example.com, localhost
myhostname = example.com
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
myorigin = /etc/mailname
readme_directory = no
recipient_delimiter = +
relayhost =
smtp_tls_CApath = /etc/ssl/certs
smtp_tls_security_level = may
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
smtpd_tls_cert_file = /etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file = /etc/ssl/private/ssl-cert-snakeoil.key
smtpd_tls_security_level = may
virtual_alias_maps = hash:/etc/postfix/virtual
答案1
OpenDKIM 不再在这里做任何事情,但它的用户opendkim
正在未送达通知也就是 Postfix 无法投递的退回邮件。队列中可能有一些邮件无法投递,因为 SMTP 端口25/tcp
被 ISP 阻止,而且退回邮件也无法投递,因为 Maildir 不存在。
您可以使用 列出队列中的消息sudo postqueue -p
,它应该显示:
-Queue ID- --Size-- ----Arrival Time---- -Sender/Recipient-------
123456789A! 1337 Fri Jan 05 13:37:00 ???@???
[email protected]
您可以使用输出中的队列 IDpostsuper -d 123456789A
来彻底删除此类消息。123456789A
postqueue -p
如果日志中出现新消息,[email protected]
请参见上面几行以了解消息的来源。