当前位置:   article > 正文

AWS:使用 SES 发送邮件 -> Python 代码_python aws ses

python aws ses

用 Python 在 AWS 调用邮件接口:

import smtplib
import email.utils
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText


class SendEmail:
    def send_email(self, content):
        SENDER = 'xxxx@xx.xxx' # 邮箱名
        SENDERNAME = 'Sender Name'
        RECIPIENT = 'anckkow@163.com' # 发送到的邮件,应该是一个 list
        USERNAME_SMTP = "xxxxxxxx" # 带有邮件权限的 IAM 帐号
        PASSWORD_SMTP = "xxxxxxxx" # 带有邮件权限的 IAM 密码
        HOST = "email-smtp.us-east-1.amazonaws.com"
        PORT = 587
        SUBJECT = 'Amazon SES Error (Python smtplib)'
        BODY_TEXT = ("Amazon SES Test\r\n"
                     "This email was sent through the Amazon SES SMTP "
                     "Interface using the Python smtplib package."
                     )
        BODY_HTML = """<html>
        <head></head>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/木道寻08/article/detail/823248
推荐阅读
相关标签
  

闽ICP备14008679号