大网数据广告活动
服务器运维问答

Configuring outgoing mail to port 587 on Ubuntu/Postfix

· 52CE 我爱测

I'm configuring a backup server on a local network that has a cable connection. The Cable ISP is filtering all port 25 (smtp) traffic. uname -a Linux myhost 4.4.0-119-generic #143-Ubuntu SMP Mon Apr 2 16:08:24 UTC 2018 x86_64 x86…

问题原文

原帖链接 · S.ov · CC BY-SA 4.0

I'm configuring a backup server on a local network that has a cable connection. The Cable ISP is filtering all port 25 (smtp) traffic.

uname -a

Linux myhost 4.4.0-119-generic #143-Ubuntu SMP Mon Apr 2 16:08:24 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

As a result, my outgoing mail transactions are timing out because (I suspect) the default Postfix configuration is using port 25. (I'm basically using the sendmail command from the shell to send status reports from this server)

I have confirmed I can telnet to port 587 on my destination server:

# telnet myserver.net 587

Trying x.x.x.x...
Connected to myserver.net.
Escape character is '^]'.
EHLO 220 myserver.net ESMTP Sendmail 8.14.7/8.14.7; Mon, 7 May 2018 18:16:08 
-0500 (CDT)
myhost.net
250-myserver.net Hello hostname [x.x.x.x], pleased to meet you
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-8BITMIME
250-SIZE
250-DSN
250-AUTH GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN
250-DELIVERBY
250 HELP

How can I update my Postfix installation so that it uses port 587 AND is compatible with the protocols of the server above? (encryption not needed/required unless it's already supported - don't believe TLS is on this)

I've tried editing /etc/postfix/master.cf and uncommenting this line:

smtpd     pass  -       -       y       -       -       smtpd

But I'm still getting timeout errors indicating that it's not using 587. I do not have ufw enabled right now so that is probably not the problem.

I assume there's some additional configuration options I need to postfix?

社区高分解答

原帖链接 · Esa Jokinen · CC BY-SA 4.0

I think you are trying to relay all outbound mail through an external mailserver using submission (port 587). Anything else wouldn't make sense, because the submission is for providing authenticated SMTP to clients while the normal communication between MTAs is done using SMTP port 25.

The submission configuration in /etc/postfix/master.cf is for providing submission smtpd for your clients and doesn't alter the behaviour how Postfix sends the outbound mail.

Instead, you'd need to configure the next-hop destination of non-local mail i.e. relayhost in main.cf and the authentication for this connection, e.g.

smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = static:USERNAME:PASSWORD
smtp_sasl_security_options = noanonymous 
smtp_tls_security_level = encrypt

relayhost = [198.51.100.10]:587

While Postfix Standard Configuration Examples for a local network has this information, it may be hard to interpret. Luckily, there are many detailed tutorials for this specific intended usage, including:

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2018-05-07)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。