你如何使用 aws ses 发送电子邮件并使用 django-amazon-ses 获取信号

how do you send emails with aws ses and get signals with django-amazon-ses

我已按照 django-amazon-ses 中的设置说明进行操作

https://pypi.python.org/pypi/django-amazon-ses/1.0.0

但是我如何使用带有 django-amazon-ses 的 AWS SES 实际发送电子邮件?

我只看到信号(pre_send 和 post_send),但是实际使用 aws ses 发送电子邮件并接收信号的方法是什么?是否有进一步的配置,如主题、正文等?

最简单的方法是使用 SES 作为 SMTP 服务器。

  1. 创建SES Credentials

  2. 配置 Django settings 以使用 SES

    EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
    EMAIL_HOST = 'email-smtp.us-east-1.amazonaws.com'
    EMAIL_PORT = 465
    EMAIL_HOST_USER = 'my_smtp_username'
    EMAIL_HOST_PASSWORD = 'my_smtp_password'
    EMAIL_USE_TLS = True
    
  3. 发送电子邮件 email function or EmailMessage

    from django.core.mail import send_mail
    send_mail(
        'Subject here',
        'Here is the message.',
        'from@example.com',
        ['to@example.com'],
        fail_silently=False,
    )