Amazon SES error: The From ARN is not a valid SES identity
Amazon SES error: The From ARN is not a valid SES identity
我是 amazone SES 的新手,正在尝试设置我的 .net 核心 API 以使用 SES 发送电子邮件。这是我用来发送电子邮件的代码:
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);
这段代码给我这样的错误:The From ARN <arn:aws:ses:eu-central-1:xxxxxxxxxxxxxx> is not a valid SES identity
。
在 AWS 控制台上验证电子邮件:
知道我做错了什么吗?
这是有效的 .NET 代码。必须在 SES 中验证发件人。参见 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);
}
}
更新
请确保您使用的是此版本。
我是 amazone SES 的新手,正在尝试设置我的 .net 核心 API 以使用 SES 发送电子邮件。这是我用来发送电子邮件的代码:
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);
这段代码给我这样的错误:The From ARN <arn:aws:ses:eu-central-1:xxxxxxxxxxxxxx> is not a valid SES identity
。
在 AWS 控制台上验证电子邮件:
知道我做错了什么吗?
这是有效的 .NET 代码。必须在 SES 中验证发件人。参见 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);
}
}
更新 请确保您使用的是此版本。