问题描述
您好,我无法连接到 google smtp 服务器.上下文是,每当用户填写表单时,我的程序都会自动将反馈通过电子邮件发送到我的 gmail 帐户.除了程序卡在 send_mail 函数中之外,一切正常.
Hello im having difficulties connecting to google smtp server. The context is that whenever a user fills in a form , my program will automatically email me the feedback to my gmail account. Everything is working except for the fact that the program is stuck within the send_mail function.
我试过这样做:
telnet smtp.gmail.com 25
Trying 2404:6800:4003:c03::6c...
这最终会导致超时.
这是我的一些代码:
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_HOST_USER = '[email protected]'
EMAIL_HOST_PASSWORD = 'xxxxxx'
EMAIL_PORT = 465
EMAIL_USE_TLS = False
EMAIL_USE_SSL = True
DEFAULT_FROM_EMAIL = EMAIL_HOST_USER
SERVER_EMAIL = DEFAULT_FROM_EMAIL
根据 wagtail 的开箱即用(django cms 包)
As per out of the box from wagtail(django cms package)
我认为这可能与我的 UFW 阻止它有关,但是我尝试禁用 UFW 并重新启动 apache2.不幸的是,这无济于事.
I thought it might have to do with my UFW blocking it , however i have tried disabling the UFW and restarting apache2 . This unfortunately does not help.
Status: active
To Action From
-- ------ ----
22/tcp ALLOW Anywhere
80/tcp ALLOW Anywhere
443/tcp ALLOW Anywhere
22/tcp (v6) ALLOW Anywhere (v6)
80/tcp (v6) ALLOW Anywhere (v6)
443/tcp (v6) ALLOW Anywhere (v6)
我真的迷路了!请帮忙 .谢谢
I am really lost! Please help . Thanks
推荐答案
新创建的 Linode 帐户默认限制使用邮件端口(25、465 和 587).
Newly created Linode accounts restrict the use of mailing ports (25, 465, and 587) by default.
为了打击垃圾邮件,在 2019 年 11 月 5 日星期二之后创建的新 Linode 帐户默认限制了邮件端口(25、465 和 587)(请参阅我们的博客文章 此处 了解更多信息).
但是,如果您想使用 Linodes 发送电子邮件,您首先需要配置:
However, If you would like to use your Linodes for sending emails, you will first need to configure :
- 有效的 DNS A 记录和
- 您计划用于发送电子邮件的任何 Linode 的 rDNS.
您可以在此处查看如何操作:[来源]
You can see how to do that here: [source]
这篇关于无法连接到 gmail smtp linode django apache2 设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!