我尝试使用亚马逊 SES 服务发送电子邮件。我的代码取自他们的文档:
public static void SendWithSMTP(string username, string password, string host, int port)
{
using (var client = new System.Net.Mail.SmtpClient(host, port))
{
client.Credentials = new System.Net.NetworkCredential(username, password);
client.EnableSsl = true;
client.Send("from@example.com", "to@example.com", "This is a test subject.", "This is a test email message body.");
}
问题是我得到以下异常:
SMTP 服务器需要安全连接或客户端未通过身份验证。服务器响应是:需要身份验证
有没有人遇到相同或类似的问题?关于这个问题有什么建议吗?