我在将Django连接到google g-suite帐户时遇到了问题:
当前设置如下:
SITE_ID = 1
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_USE_TLS = True
EMAIL_PORT = 587
EMAIL_HOST_USER = 'noreply@mydomain.com'
EMAIL_HOST_PASSWORD = '16CharacterAppPassword'
DEFAULT_FROM_EMAIL = EMAIL_HOST_USER我已经尝试过的设置:注意,用逗号分隔我尝试过的所有可能组合的不同设置
EMAIL_HOST = 'smtp.gmail.com', 'smtp-relay.gmail.com', 'mail.mydomain.com'
EMAIL_USE_TLS = True, False
EMAIL_USE_SSL = False, True
EMAIL_PORT = 587, 25, 465
EMAIL_HOST_USER = 'noreply@mydomain.com'
EMAIL_HOST_PASSWORD = '16CharacterAppPassword', 'mynormalpassword'我尝试过的其他方法如下:
LessSecure settings: On/Off
App Password: Tried 2 two different ones just incase the first one messed up
Contact G-Suite support: They had a look at the settings and everything is fine from their end
Tried CaptchaLink
Tried verifying last login attempt as 'it was me' so it won't block the IP尝试了以下教程:G-Suite Smtp
如果可能有帮助,请提供更多详细信息:
Server: Pythonanywhere
Domain: Google registered domain
Python: 3.8
Django: 3.1.1
django-allauth: 0.42.0尝试发送电子邮件时收到错误消息:
SMTPAuthenticationError: Username and Password not accepted learn more at ...已按照提供的链接进行操作并尝试了所有故障排除方法。
编辑:48小时后,它是随机工作的,并没有什么真正改变的方面,我已经尝试。如果有人知道可能是什么原因,我会把这个留着?我唯一能想到的就是DNS传播,但不能确认,因为支持人员提到他们这边一切都很好。
发布于 2020-09-06 02:41:06
也许SITE_ID是错误的,尝试通过以下命令进入外壳并获得正确的SITE_ID:
from django.contrib.sites.models import Site
new_site = Site.objects.create(domain='....', name='....')
print new_site.idhttps://stackoverflow.com/questions/63757248
复制相似问题