无法连接到SMTP服务器以直接发送电子邮件而无需身份验证

时间:2016-04-19 08:36:04

标签: python email smtp

我相信我们可以直接向目标MX服务器发送电子邮件,例如(' gmail-smtp-in.l.google.com',25)。但是,即使使用Python 3.5.1中的套接字编程,我也无法连接到邮件服务器。

import socket
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock:
    sock.connect(('gmail-smtp-in.l.google.com', 25))

上面的代码总是在第3行给出以下错误。

TimeoutError: [WinError 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

我发现人们[1]能够连接到上面提到的服务器,请帮助我解决这个问题,因为在经过数小时的研究工作后我仍然无能为力。

请注意,我正在本地计算机上运行代码。

[1]。 How to send a mail directly to SMTP server without authentication?

0 个答案:

没有答案
相关问题