【问题标题】:SES from AWS does not work with Django due to unverified Email由于未经验证的电子邮件,来自 AWS 的 SES 不适用于 Django
【发布时间】:2020-07-27 03:54:30
【问题描述】:

我尝试以示例用户身份注册 Deployed Django 应用,但出现服务器错误 (500)。

这是错误日志

raise error_class(parsed_response, operation_name)
botocore.errorfactory.MessageRejected: An error occurred (MessageRejected) when calling the SendRawEmail operation: Email address is not verified. The following identities failed the check in region US-EAST-1: webmaster@localhost
2020-07-27 12:32:52,406 [ERROR] /home/app_admin/venv_private_diary/lib64/python3.7/site-packages/django/core/servers/basehttp.py(Line:154)      "POST /accounts/login/ HTTP/1.0" 500 27

在错误消息中“webmaster@localhost”表示 Django 应用程序发送默认电子邮件地址,因此我在 settings.py 中添加了此语句。

DEFAULT_FROM_EMAIL = 'my@emailaddress.com'

但是,同样的错误信息出现了。 我应该在哪里检查??

【问题讨论】:

  • 我也遇到了同样的问题,请问您解决了吗?
  • 我不得不设置两个新的变量来摆脱这个错误。 DEFAULT_FROM_EMAIL = SERVER_EMAIL = EMAIL_HOST_USER

标签: python django amazon-ses


【解决方案1】:

我遇到了同样的错误,这是一个简单的错误:我没有在 settings.py 中正确设置所有 django-ses 变量,特别是那些定义您发送的 AWS 区域的变量:

EMAIL_BACKEND = 'django_ses.SESBackend'

# These are optional -- if they're set as environment variables they won't
# need to be set here as well
AWS_ACCESS_KEY_ID = 'YOUR-ACCESS-KEY-ID'
AWS_SECRET_ACCESS_KEY = 'YOUR-SECRET-ACCESS-KEY'

# Additionally, if you are not using the default AWS region of us-east-1,
# you need to specify a region, like so:
AWS_SES_REGION_NAME = 'us-west-2'
AWS_SES_REGION_ENDPOINT = 'email.us-west-2.amazonaws.com'

这取自the django-SES github page

默认情况下,电子邮件将从 AWS 区域 US-East-1 发送,如您的错误所述,所以我猜这是您的问题。

【讨论】:

    猜你喜欢
    • 2020-01-16
    • 2019-08-22
    • 2016-09-28
    • 2018-11-17
    • 2017-10-12
    • 1970-01-01
    • 2016-01-15
    • 1970-01-01
    相关资源
    最近更新 更多