我测试下面的代码用不同的电子邮件服务器,只有smtp.gmail.com是响应以下简单的代码:为什么有些电子邮件服务器不响应smtlib.SMTP('xxxx')?
>>> import smtplib
>>> s=smtplib.SMTP('smtp.gmail.com')
>>> s.help()
'2.0.0 https://www.google.com/search?btnI&q=RFC+5321 b188sm4817528wmh.6 - gsmtp'
>>> s.quit()
(221, '2.0.0 closing connection b188sm4817528wmh.6 - gsmtp')
很确定。
但是这(和许多其他提供商)超时:
>>> s=smtplib.SMTP('smtpmail.t-online.de')
返回错误:
error: [Errno 10061] No connection could be made because the target machine actively refused it
或
>>> s=smtplib.SMTP('wpxxxxxxxx.mailout.server-he.de',25)
返回:
error: [Errno 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
我认为是因为SSL。所以我用:
>>> smtplib.SMTP_SSL("wpxxxxxxx.mailout.server-he.de", 465)
尝试与不同的端口nr的。电子邮件服务器的名称一定正确 那么什么是独特的关于smtp.gmail.com? 我怎么能让其他人工作?
-Thanks-
尝试使用端口587。 – Barmar