用 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>