You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用Postfix作为MTA从Linux邮件命令向Gmail地址发送邮件时的连接超时问题求助

Postfix作为MTA从Linux邮件命令向Gmail地址发送邮件时的连接超时问题求助

大家好,我是邮件投递系统配置的新手,目前在本地大学工作。最近管理层要求我们在客户完成申请时发送确认邮件,而且邮件得是noreply类型的,所以我找了个仅发送的Postfix配置方案跟着操作,大部分步骤都没遇到问题,但测试发送邮件时却碰到了连接超时的情况。

测试后我在系统日志里看到了这些内容:

Apr 16 08:53:03 application postfix/pickup[360142]: DA25140A2775: uid=0 from=<root@college.ph>
Apr 16 08:53:03 application postfix/cleanup[360716]: DA25140A2775: message-id=<20230416005303.DA25140A2775@college.ph>
Apr 16 08:53:03 application postfix/qmgr[360143]: DA25140A2775: from=<root@college.ph>, size=415, nrcpt=1 (queue active)
Apr 16 08:53:34 application postfix/smtp[360718]: connect to gmail-smtp-in.l.google.com[74.125.204.27]:25: Connection timed out
Apr 16 08:53:49 application postfix/smtp[360718]: connect to alt1.gmail-smtp-in.l.google.com[142.250.141.26]:25: No route to host
Apr 16 08:54:04 application postfix/smtp[360718]: connect to alt2.gmail-smtp-in.l.google.com[142.250.115.27]:25: No route to host
Apr 16 08:54:34 application postfix/smtp[360718]: connect to alt3.gmail-smtp-in.l.google.com[64.233.171.27]:25: Connection timed out
Apr 16 08:55:04 application postfix/smtp[360718]: connect to alt4.gmail-smtp-in.l.google.com[142.250.152.26]:25: Connection timed out
Apr 16 08:55:04 application postfix/smtp[360718]: DA25140A2775: to=<myreceivingemail@gmail.com>, relay=none, delay=121, delays=0.46/0.01/121/0, dsn=4.4.1, status=deferred (connect to alt4.gmail-smtp-in.l.google.com[142.250.152.26]:25: Connection timed out)

(注:为了隐私,我修改了域名和邮箱地址)

我的Postfix配置如下:

smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
biff = no
append_dot_mydomain = no
readme_directory = no
compatibility_level = 3.6
smtpd_tls_cert_file=/etc/letsencrypt/live/college.ph/cert.pem
smtpd_tls_key_file=/etc/letsencrypt/live/college.ph/privkey.pem
smtpd_tls_security_level=may
smtp_tls_CApath=/etc/ssl/certs
smtp_tls_security_level=may
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
myhostname = college.ph
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = college.ph
relayhost =
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = loopback-only
inet_protocols = ipv4
mynetworks = 127.0.0.1/32

另外补充一下:因为我们的ISP把25端口封得死死的,所以我把Postfix配置成监听3000/TCP端口,端口转发、SPF和DMARC都已经设置到位了,但还是出现这个问题。

请问我哪里做错了?提前谢谢大家的帮助!

备注:内容来源于stack exchange,提问作者Minmin

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.22 15:47:58