Django和AWS简单电子邮件服务 [英] Django and AWS Simple Email Service

查看:119
本文介绍了Django和AWS简单电子邮件服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试建立django网站并使其运行,并且正在尝试启用django的标准密码重置服务.

I'm attempting to get a django site up and running and I'm trying to enable django's standard password reset service.

我的网站由AWS EC2托管,因此我想将AWS SES用于我的电子邮件服务.但是,我无法使smtp连接正常工作.有关如何解决以下错误的任何想法:

My site is hosted by AWS EC2, so I figured I would use AWS SES for my email service. However, I can't get the smtp connection to work. Any idea on how to solve for the following error:

异常类型:SMTPSenderRefused 异常值:(530,b'需要身份验证','example@example.com')

Exception Type: SMTPSenderRefused Exception Value: (530, b'Authentication required', 'example@example.com')

我查看了以下内容,但我希望尽可能地使用django的内置电子邮件后端:

I've looked at the following, but I'd prefer to stay with django's built-in email back-ends if possible:

  • https://github.com/django-ses/django-ses
  • https://github.com/azavea/django-amazon-ses
  • Amazon SES SMTP with Django

电子邮件设置:

EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'email-smtp.us-west-2.amazonaws.com'
EMAIL_PORT = 587 # (I've also tried 25, 465, & 2587)
EMAIL_HOST_USER = ''
EMAIL_PASSWORD = ''
EMAIL_USE_TLS = True
DEFAULT_FROM_EMAIL = 'example@example.com' # but my real email address

我的EMAIL_HOST_USER和EMAIL_PASSWORD设置为我按照以下说明获得的SMTP凭据: https://docs.aws.amazon.com/ses/latest/DeveloperGuide/smtp-credentials.html

My EMAIL_HOST_USER and EMAIL_PASSWORD are set to my SMTP credentials I obtained by following the instructions at: https://docs.aws.amazon.com/ses/latest/DeveloperGuide/smtp-credentials.html

此外,我确保按照以下说明验证我的DEFAULT_FROM_EMAIL和我的域: https://docs.aws.amazon.com/ses/latest/DeveloperGuide/verify-addresses-and-domains.html

Also, I was sure to verify my DEFAULT_FROM_EMAIL and my domain following these instructions: https://docs.aws.amazon.com/ses/latest/DeveloperGuide/verify-addresses-and-domains.html

并且启用了DKIM,并且我的名称服务器已更新.

And DKIM is enabled and my nameservers have been updated.

我们将不胜感激.

更新:

我能够使用django-ses 3rd party库发送django电子邮件,但是我仍然无法弄清为什么标准后端无法通过SMTP起作用.

I was able to get the django email send working with the django-ses 3rd party library, but I'm still not able to figure out why the standard backend doesn't work via SMTP.

我认为我的代码肯定存在问题,因为我甚至将电子邮件客户端从AWS SES切换到Zoho邮件,而且我仍然收到相同的530 Authentication required错误.

I think there is definitely something wrong with my code as I went so far as to switch email clients from AWS SES to Zoho mail and I'm still receiving the same 530 Authentication required error.

EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'smtp.zoho.com'
EMAIL_PORT = 587
EMAIL_HOST_USER = 'support@example.com'
EMAIL_USE_TLS = True
DEFAULT_FROM_EMAIL = 'support@example.com'
EMAIL_PASSWORD = ''

推荐答案

如果要求进行身份验证,请仔细检查以下内容:

If it is asking for Authentication, please double-check the following:

  • 您的SMTP设置
  • 您尝试从中发送邮件的电子邮件属于已验证的域.例如如果您已验证example.com,但尝试从something@gmail.com发送电子邮件,它将要求提供gmail身份验证凭据.
  • Your SMTP settings
  • The email that you're trying to send mails from belongs to the verified domain. e.g. if you have verified example.com but you try sending emails from something@gmail.com, it is going to ask for gmail auth credentials.

这篇关于Django和AWS简单电子邮件服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆