小编Eri*_*rst的帖子

尝试从 EC2 实例发送邮件时出现“需要身份验证”SmtpException

我正在运行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中,我做了以下工作:

  1. 已完成我的“发件人”地址和“收件人”地址的“验证新电子邮件地址”流程。(根据发送统计页面,我的 SES 帐户仍然具有“沙箱”访问权限。)
  2. 在 SES 域下验证了我的 companyname.com
  3. 在 SES 域下启用 DKIM 设置
  4. 在 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 实例,但我不知道。

amazon-ec2 amazon-web-services amazon-ses

4
推荐指数
1
解决办法
5427
查看次数