【发布时间】:2020-05-06 08:52:49
【问题描述】:
我有一个安装了 Postfix SMTP 服务的服务器,我可以像这样使用 bash 发送消息:
echo "This is the body of the email" | mail -s "This is the subject line" user@example.com
但是当我尝试用 Python 做同样的事情时,它会永远挂起:
import smtplib
s = smtplib.SMTP('localhost')
s.send_message('')
脚本挂在第二行,不清楚原因。 我检查了 iptables 的配置(它是空的),我仍然可以使用 bash 命令发送消息。
“telnet localhost 25”也可以正常工作,端口是开放的。
后缀配置文件:
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = localhost
mynetworks = 127.0.0.0/8
myorigin = /etc/mailname
【问题讨论】:
标签: postfix-mta smtplib