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

Postfix Connection refused (port 25)

· 52CE 我爱测

I'm trying to send email through a Postfix server. From the command line, if I enter: echo "This is the body of the email" | mail -s "subject line" [email omitted]` Then the error I see in log/mail.info is: postfix/smtp[23093]: c…

问题原文

原帖链接 · Rick Jolly · CC BY-SA 3.0

I'm trying to send email through a Postfix server. From the command line, if I enter:

echo "This is the body of the email" | mail -s "subject line" [email omitted]`

Then the error I see in log/mail.info is:

postfix/smtp[23093]: connect to mail.mydomain.com[my.ip.add.here]: Connection refused (port 25)

If I enter netstat -an |more, I see:

...
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN
...

No 0.0.0.0:25 if that makes a difference?

Edit

If I run netstat -plntu, then I see 3587/master as the pid/program name for 127.0.0.1:25. I see no postfix listed for pid/program name. Could it be that the mail server isn't running. I was told that it was.

...
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      3587/master
...

Edit

Confirmed Postfix is running by typing postfix start

Edit

Tried this on the server if it helps:

telnet mail.mydomain.com 25
Trying 202.192.77.135...
telnet: connect to address 202.192.77.135: Connection refused

I know this problem has been solved many times, but I'm a simple web developer and I might need a little more guidance. Thank you.

已采纳解答

原帖链接 · DBLaci · CC BY-SA 3.0

The mail log shows that you CAN connect to your postfix server (on localhost). The postfix cannot connect to the external smtp server (mail.mydomain.com), and you can't connect with telnet either.

Perhaps you have a firewall (at your ISP) that blocks the outgoing smtp. This is common to block spam. For workaround you can use other mail server (gmail?) for relaying your e-mails, and connect to it on secure smtp (port 465 / 587) and authentication.

This is a great howto for this: https://www.howtoforge.com/tutorial/configure-postfix-to-use-gmail-as-a-mail-relay/

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

资料来源与适用范围

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

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

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