我想使用亚马逊的简单电子邮件服务发送电子邮件。
我验证了我的域名以及我想发送的电子邮件地址。
两者都显示已核实。
现在,当我从AWS控制台使用发送测试电子邮件向myemail@outlook.com发送测试电子邮件时,我只得到错误消息:
电子邮件地址未验证。下面的标识失败了
check in region EU-WEST-1: myemail@outlook.com(请求ID:
9 fb78de1 - 2673 - 11 - e6 bbbc - 5 - f819fabe4f4)
现在它让我震惊,因为它说myemail@outlook.com没有经过验证,但我试图从admin@mydomain.example发送。发送测试电子邮件对话框甚至强迫您使用已经注册的电子邮件。
如何解决这个问题?我错过什么了吗?
我有这个问题。我验证了域名和电子邮件,甚至DKIM设置也得到了验证。
但还是得到了这样的信息:
Email address is not verified. The following identities failed the check in region {aws_region}: {email}
我添加了SourceArn作为sendEmail的参数,然后得到这条消息:
User `arn:aws:iam::{account_id}:user/{username}' is not authorized to perform `ses:SendEmail' on resource `arn:aws:ses:{aws_region:{account_id}:identity/{email}'
2天后,我发现我使用了错误的IAM用户!
在我的情况下,我想发送电子邮件到相同的验证电子邮件。
所以,我验证了我的邮件是DKIM @Greg Wozniak写的。我看到了绿色的标记,并验证了:
但我仍然看到:
Email address is not verified. The following identities failed the check in region...
在我的情况下,解决方案是在代码中添加这个函数:
def verify_email_identity():
ses_client = boto3.client("ses", region_name="us-east-1")
response = ses_client.verify_email_identity(
# Email address that will receive the email
# In my case the same email address
# that was verified on Amazon SES
EmailAddress="receipientemail@gmail.com"
)
print(response)
从这个网站上截取
所以,我收到了一封新的邮件来验证收件人的邮箱地址。确认收件人邮箱地址后,点击亚马逊SES发送的链接。我可以用这个代码发送邮件:
client = boto3.client('ses',region_name="us-east-1")
# Try to send the email.
try:
#Provide the contents of the email.
response = client.send_email(
Destination={
'ToAddresses': [
receipientemail@gmail.com,
],
},
Message={
'Body': {
'Html': {
'Charset': "UTF-8",
'Data': "Test",
},
},
'Subject': {
'Charset': "UTF-8",
'Data': "Test",
},
},
Source=receipientemail@gmail.com,
)
# Display an error if something goes wrong.
except ClientError as e:
print(e.response['Error']['Message'])
else:
print("Email sent! Message ID:"),
print(response['MessageId'])