Errno 10060连接尝试失败 [英] Errno 10060 A connection attempt failed
问题描述
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST='smtp.gmail.com'
EMAIL_PORT=465
EMAIL_HOST_USER = 'yogi'
EMAIL_HOST_PASSWORD = '###'
DEFAULT_EMAIL_FROM = 'yogi@gmail.com'
上面是django核心邮件模块的设置。我正在使用它的send_mail向用户发送邮件。当我尝试使用gmail smtp构建程序时,会引发以下错误
above are the settings for django core mail module. I am using its send_mail to send mails to users. When i try to build the program with the gmail smtp it throws the following error
'Errno 10060连接尝试失败,因为连接方
在一段时间后未正确响应,或已建立的
连接失败,因为已连接的主机未能响应'。
'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'.
我在公司中这样做,因此具有代理设置。我在.condarc设置文件中提供了代理凭据。但仍然是连接超时错误。我是否需要在其他地方设置代理设置,或者让我知道我要去哪里。 ?
I am doing this in my company and so it has proxy settings. I have given the proxy credentials in .condarc settings file. But still the connection timeout error. Do i need to set the proxy settings somewhere else or let me know where i am going wrong. ?
推荐答案
据我所知django并未从anaconda配置文件中检测到任何SMTP代理设置。您可以通过手动建立连接来克服这个问题。
As far as I know django does not detect any SMTP proxy settings from anaconda configuration files. You can overcome this by manually building a connection.
请注意 send_mail ,具有用于连接的选项参数。您现在可以通过调用 mail.get_connection 来获得一个将其包装在sockspi上
Notice that send_mail , has an option parameter for a connection. You get one by calling mail.get_connection now you need to wrap it around sockspi
请参见 Python smtplib代理支持和 Python在代理服务器后面发送电子邮件进一步的细节。
see Python smtplib proxy support and Python send email behind a proxy server for further details.
这篇关于Errno 10060连接尝试失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!