Django SendGrid + allauth

3

我目前正在尝试使用SendGrid发送确认电子邮件给注册的社交账户用户,但出现以下错误:

SMTPDataError at /accounts/facebook/login/callback/
(550, b'The from address does not match a verified Sender Identity. Mail cannot be sent until this error is resolved. Visit https://sendgrid.com/docs/for-developers/sending-email/sender-identity/ to see the Sender Identity requirements')

我已经在SendGrid上完成了单发件人验证,因此在那一端应该一切正常,但为了确保,我也联系了SendGrid。 以下是我的设置,以防万一有什么遗漏?

EMAIL_PORT = 587
EMAIL_USE_TLS = True
EMAIL_HOST_USER = 'apikey' # this is exactly the value 'apikey'
EMAIL_HOST_PASSWORD = config('SENDGRID_API_KEY')
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'

非常感激您的任何帮助。
1个回答

9

我自己遇到了这个问题,发现需要以下两个设置,除了上面提到的那些设置:

EMAIL_HOST = 'smtp.sendgrid.net'
# the email you verified with sendgrid (if you did single sender verification)
DEFAULT_FROM_EMAIL = 'myverifiedemailaddress@provider.com'

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接