簡體   English   中英

我正在嘗試通過Python中的“localhost”發送電子郵件,但它一直給我一個“錯誤61”

[英]I'm trying to send email through 'localhost' in Python but it keeps giving me an “Error 61”

我正在運行Mac OS X並使用postfix來啟用localhost。 這是我收到的錯誤消息:

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

首先使用netstat驗證SMTP服務器是否綁定到適當接口的端口25。

檢查postfix日志文件,可能是/var/log/mail或類似的東西,具體取決於你安裝postfix的方式。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM