我在Python中通过'localhost'发送邮件,但一直显示"错误 61
我在使用Mac OS X系统,并且用postfix来启用本地服务器。可是我遇到了这个错误信息:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/smtplib.py", line 239, in __init__
(code, msg) = self.connect(host, port)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/smtplib.py", line 295, in connect
self.sock = self._get_socket(host, port, self.timeout)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/smtplib.py", line 273, in _get_socket
return socket.create_connection((port, host), timeout)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py", line 571, in create_connection
raise err
socket.error: [Errno 61] Connection refused
2 个回答
0
查看一下后缀日志文件,这个文件可能在 /var/log/mail
这个位置,或者其他类似的地方,具体取决于你是怎么安装后缀服务的。
2
首先,使用 netstat
这个工具来检查一下,SMTP服务器是否已经绑定在合适的网络接口的25号端口上。