[英]Amazon SES error: The From ARN is not a valid SES identity
I am new to amazone SES and trying to set up my .net core API to send emails using SES.我是亚马逊 SES 的新手,正在尝试设置我的 .net 核心 API 以使用 SES 发送电子邮件。 Here is code I`m using to send emails:这是我用来发送电子邮件的代码:
SendEmailRequest request = new SendEmailRequest();
request.FromEmailAddress = "email@outlook.com";//verified
//request.
Destination destination= new Destination();
destination.ToAddresses = new List<string> {"some verified email"};
request.Destination = destination;
EmailContent content = new EmailContent();
content.Simple = new Message
{
Body = new Body
{
Html = new Content
{
Data = $@"<html>
//here is some code
</html>"
}
},
Subject = new Content{
Data = "some subject"
}
};
request.Content = content;
request.FromEmailAddressIdentityArn = senderArn;
var status = await _sesClient.SendEmailAsync(request);
This code gives me such error: The From ARN <arn:aws:ses:eu-central-1:xxxxxxxxxxxxxx> is not a valid SES identity
.此代码给我这样的错误: The From ARN <arn:aws:ses:eu-central-1:xxxxxxxxxxxxxx> is not a valid SES identity
。 On AWS console emails are verified:在 AWS 控制台上验证电子邮件:
Any ideas what I`m doing wrong?知道我做错了什么吗?
Here is .NET Code that does work.这是 .NET 有效的代码。 The sender has to be verified in SES.必须在 SES 中验证发件人。 See https://docs.aws.amazon.com/ses/latest/dg/creating-identities.html .请参阅https://docs.aws.amazon.com/ses/latest/dg/creating-identities.html 。
public async void SendMessage(string text, string toAddress)
{
var sesClient = new AmazonSimpleEmailServiceClient(RegionEndpoint.USWest2);
var sender = "scmacdon@amazon.com";
var emailList = new List<string>();
emailList.Add(toAddress);
var destination = new Destination
{
ToAddresses = emailList
};
var content = new Content
{
Data = text
};
var sub = new Content
{
Data = "Amazon Rekognition Report"
};
var body = new Body
{
Text = content
};
var message = new Message
{
Subject = sub,
Body = body
};
var request = new SendEmailRequest
{
Message = message,
Destination = destination,
Source = sender
};
try
{
await sesClient.SendEmailAsync(request);
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
}
Update Make sure you are using this version.更新确保您使用的是这个版本。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.