![](/img/trans.png)
[英]How to fix ConnectionRefusedError: [WinError 10061] the target machine actively refused it? (Django e.mails)
[英]How to solve the ConnectionRefusedError: [WinError 10061] the target machine actively refused it? (Django SMTP)
我已經閱讀了許多嘗試實施但沒有運氣的解決方案。請建議解決此問題,以下是我的代碼中實施的內容。
在views.py 文件中
s = smtplib.SMTP(IP Address, Port)
s.ehlo()
s.sendmail("a@b.com", 'c@d.com', msg.as_string())
print("printing the S object", s.__dict__)
s.quit()
Output 我得到:
連接被拒絕錯誤。 贏 [16001]
使用 windows 平台,我沒有管理員權限,防火牆被禁用。
您可以為此做的解決方法 * 檢查您是否有權連接到 SMTP 服務器。您可以嘗試 netcat 或 telnet。 * 如果您無法連接到 SMTP,您必須確保您的本地 ip 應啟用。
試試這個選項,它可以幫助您連接 SMTP。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.