我有一个使用 ssl 的带有 postfix 和 dovecot 的邮件服务器。一切运行正常,但它似乎无缘无故地停止了工作。我已经尝试更新 ssl 证书,将 inet_protocols 更改为在 main.cf 上仅接受 ipv4,更改 mydestionation 参数,但都不起作用。
/etc/postfix/main.cf
alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
append_dot_mydomain = no
biff = no
config_directory = /etc/postfix
inet_interfaces = all
inet_protocols = ipv4
mailbox_size_limit = 0
mydestination = localhost
mydomain = domain.com.br
myhostname = mail.domain.com.br
mynetworks = 127.0.0.1 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
myorigin = /etc/mailname
readme_directory = no
recipient_delimiter = +
relayhost =
smtp_tls_security_level = may
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
smtpd_recipient_restrictions = permit_sasl_authenticated, permit_mynetworks, reject_unauth_destination
smtpd_sasl_auth_enable = yes
smtpd_sasl_path = private/auth
smtpd_sasl_type = dovecot
smtpd_tls_CAfile = /etc/letsencrypt/live/domain.com.br/chain.pem
smtpd_tls_auth_only = yes
smtpd_tls_cert_file = /etc/letsencrypt/live/domain.com.br/cert.pem
smtpd_tls_key_file = /etc/letsencrypt/live/domain.com.br/privkey.pem
smtpd_tls_security_level = may
smtpd_use_tls = yes
virtual_alias_maps = mysql:/etc/postfix/mysql-virtual-alias-maps.cf
virtual_mailbox_domains = mysql:/etc/postfix/mysql-virtual-mailbox-domains.cf
virtual_mailbox_maps = mysql:/etc/postfix/mysql-virtual-mailbox-maps.cf
virtual_transport = lmtp:unix:private/dovecot-lmtp
突击队mailq
-Queue ID- --Size-- ----Arrival Time---- -Sender/Recipient-------
1F7A4C0012 849 Wed Jan 3 16:40:28 [email protected]
(connect to alt4.gmail-smtp-in.l.google.com[173.194.79.27]:25: Connection timed out)
[email protected]
5873EC0414 1259 Wed Jan 3 16:49:44 [email protected]
(connect to alt4.gmail-smtp-in.l.google.com[173.194.79.27]:25: Connection timed out)
[email protected]
感谢您的帮助。
编辑:在 smtpd 上启用详细功能后,我发现了以下奇怪的行:
Jan 4 10:45:05 user postfix/smtpd[4729]: ctable_locate: leave existing entry key [email protected]
Jan 4 10:45:05 user postfix/smtpd[4729]: maps_find: recipient_canonical_maps: [email protected]: not found
Jan 4 10:45:05 user postfix/smtpd[4729]: match_string: yahoo.com.br ~? localhost
Jan 4 10:45:05 user postfix/smtpd[4729]: match_list_match: yahoo.com.br: no match
Jan 4 10:45:05 user postfix/smtpd[4729]: maps_find: recipient_canonical_maps: @yahoo.com.br: not found
Jan 4 10:45:05 user postfix/smtpd[4729]: mail_addr_find: [email protected] -> (not found)
Jan 4 10:45:05 user postfix/smtpd[4729]: maps_find: canonical_maps: [email protected]: not found
Jan 4 10:45:05 user postfix/smtpd[4729]: match_string: yahoo.com.br ~? localhost
Jan 4 10:45:05 user postfix/smtpd[4729]: match_list_match: yahoo.com.br: no match
Jan 4 10:45:05 user postfix/smtpd[4729]: maps_find: canonical_maps: @yahoo.com.br: not found
Jan 4 10:45:05 user postfix/smtpd[4729]: mail_addr_find: [email protected] -> (not found)
Jan 4 10:45:05 user postfix/smtpd[4729]: dict_mysql_get_active: attempting to connect to host 127.0.0.1
Jan 4 10:45:05 user postfix/smtpd[4729]: dict_mysql: successful connection to host 127.0.0.1
Jan 4 10:45:05 user postfix/smtpd[4729]: dict_mysql: successful query from host 127.0.0.1
Jan 4 10:45:05 user postfix/smtpd[4729]: dict_mysql_lookup: retrieved 0 rows
Jan 4 10:45:05 user postfix/smtpd[4729]: maps_find: virtual_alias_maps: [email protected]: not found
Jan 4 10:45:05 user postfix/smtpd[4729]: match_string: yahoo.com.br ~? localhost
Jan 4 10:45:05 user postfix/smtpd[4729]: match_list_match: yahoo.com.br: no match
Jan 4 10:45:05 user postfix/smtpd[4729]: dict_mysql_get_active: found active connection to host 127.0.0.1
Jan 4 10:45:05 user postfix/smtpd[4729]: dict_mysql: successful query from host 127.0.0.1
Jan 4 10:45:05 user postfix/smtpd[4729]: dict_mysql_lookup: retrieved 0 rows
Jan 4 10:45:05 user postfix/smtpd[4729]: maps_find: virtual_alias_maps: @yahoo.com.br: not found
Jan 4 10:45:05 user postfix/smtpd[4729]: mail_addr_find: [email protected] -> (not found)
答案1
看起来您正在尝试通过 Google 发送所有邮件(可能发送给您)。几个问题:
- 您有动态 IP 地址吗?这将导致无法发送外发邮件。配置您的 Postfix 服务器以使用您的 ISP 的电子邮件中继进行发送。
- 您是否安装或修改了防火墙?请确保已启用端口 25 上的传出流量。
- 您是否通过 Google 中继到多个地址?配置 Postfix 以在端口 587 (提交) 上使用经过身份验证的连接。
- 您是否尝试过使用支持 TCP 的跟踪路由来确定您的连接在哪里中断?您的 ISP 可能选择阻止来自动态 IP 地址的传出电子邮件(垃圾邮件)流量。获取静态 IP 地址并正确配置我们的 SMTP 服务器:rDNS 验证;SPF;DKIM;DMARC;等等。
阅读规范答案避免你的电子邮件被归类为垃圾邮件. 搜索有关交付问题的其他答案。