Python 尝试使用 Django 发送电子邮件时出现“[Errno 101] 网络无法访问”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/14949492/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
"[Errno 101] Network is unreachable" when trying to send email using Django
提问by initWithStyle
For some reason I am getting this error when trying to send an email (with gmail) using Django.
出于某种原因,我在尝试使用 Django 发送电子邮件(使用 gmail)时收到此错误。
[Errno 101] Network is unreachable
The weird part about this is that it only seems to happen when my web app is running on my server (bluehost). It works fine when locally.
奇怪的是,它似乎只有在我的 Web 应用程序在我的服务器(bluehost)上运行时才会发生。它在本地运行良好。
Here are my email settings
这是我的电子邮件设置
EMAIL_USE_TLS = True
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_HOST_USER = '[email protected]'
EMAIL_HOST_PASSWORD = 'FakePassword'
EMAIL_PORT = 587
Any idea as to how I can fix this?
关于如何解决这个问题的任何想法?
采纳答案by myusuf3
This is likely to have to do with the port you are trying to send email from on the blue host machine.
这可能与您尝试从蓝色主机上发送电子邮件的端口有关。
They probably block ports like that for security reasons.
出于安全原因,他们可能会阻止这样的端口。
More info: https://my.bluehost.com/cgi/help/500

