amazon simple email service (ses) 使用小记(python)

阅读更多
1 需要帐号的 access key
2 我采用了python的库 https://github.com/pankratiev/python-amazon-ses-api

具体代码如下
第一步
verify你的发出邮件:
from amazon_ses import AmazonSES, EmailMessage
AccessKeyID = ...你的AccessKeyID
SecretAccessKey = ...你的SecretAccessKey
amazonSes = AmazonSES(AccessKeyID, SecretAccessKey)
amazonSes.verifyEmailAddress(你需要验证的发信邮件)

然后,amzon会发验证邮件到你刚验证的邮箱,点击里面链接,完成验证

第二步:
发信

from amazon_ses import AmazonSES, EmailMessage
AccessKeyID = ...你的AccessKeyID
SecretAccessKey = ...你的SecretAccessKey
amazonSes = AmazonSES(AccessKeyID, SecretAccessKey)

message = EmailMessage()
message.subject = 'hello world'
message.bodyHtml = 'hello world from ses'
r = amazonSes.sendEmail( 发信人,  收件人, message)



你可能感兴趣的:(amazon simple email service (ses) 使用小记(python))