我正在尝试通过 Postfix 服务器发送电子邮件。从命令行,如果我输入:
echo "This is the body of the email" | mail -s "subject line" me@example.com`
Run Code Online (Sandbox Code Playgroud)
然后我在 log/mail.info 中看到的错误是:
postfix/smtp[23093]: connect to mail.mydomain.com[my.ip.add.here]: Connection refused (port 25)
Run Code Online (Sandbox Code Playgroud)
如果我输入 netstat -an |more,我会看到:
...
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN
...
Run Code Online (Sandbox Code Playgroud)
不,0.0.0.0:25如果这有区别吗?
编辑
如果我运行netstat -plntu,那么我会看到3587/master127.0.0.1:25 的 pid/程序名称。我看到没有为 pid/程序名称列出后缀。可能是邮件服务器没有运行。有人告诉我是这样。
...
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 3587/master
...
Run Code Online (Sandbox Code Playgroud)
编辑
通过键入确认 Postfix 正在运行 postfix start
编辑
如果有帮助,请在服务器上尝试此操作:
telnet mail.mydomain.com 25
Trying 202.192.77.135...
telnet: connect to address 202.192.77.135: …Run Code Online (Sandbox Code Playgroud)