我正在运行https://docs.aws.amazon.com/ses/latest/DeveloperGuide/send-using-smtp-net.html中列出的 C# 代码,尝试从 EC2 实例发送测试电子邮件。我可以使用 gmail SMTP 服务器轻松运行等效代码,但是当我使用 SES 作为 SMTP 服务器时,出现 SmtpException 并显示错误消息:
The SMTP server requires a secure connection or the client was not authenticated. The server response was: Authentication required
Run Code Online (Sandbox Code Playgroud)
在SES中,我做了以下工作:
{
"Version": "2008-10-17",
"Statement": [
{
"Sid": "stmt123456789",
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::1234567890:user/ses-smtp-user.20190805-123456"
},
"Action": [
"ses:SendEmail",
"ses:SendRawEmail"
],
"Resource": "arn:aws:ses:us-west-2:1234567890:identity/mycompany.com"
}
]
}
Run Code Online (Sandbox Code Playgroud)
我怀疑问题出在我的身份策略或我如何将其链接回我的 EC2 实例,但我不知道。