【发布时间】:2014-04-03 10:34:48
【问题描述】:
我从亚马逊服务器开始研究 SES。 我正在使用asp.net C#并制作了我的基于代码的教程。 我已经检查了域,还检查了我将在其中运行测试的电子邮件。
因此,当我运行我的代码时,它会生成以下错误消息:事务失败。服务器响应是:消息被拒绝:电子邮件地址未验证。
我不知道它是什么,因为我遵循了所有可能的步骤,还没有命令发布访问生产的单个详细信息。
但我认为不可能,我还在测试服务。
我的代码
public void enviarSES02()
{
try
{
const String FROM = "verified email address";
const String TO = "verified email address";
const String SUBJECT = "Amazon SES test (SMTP interface accessed using C#)";
const String BODY = "This email was sent through the Amazon SES SMTP interface by using C#.";
const String SMTP_USERNAME = "my username"; // Replace with your SMTP username.
const String SMTP_PASSWORD = "my password"; // Replace with your SMTP password.
const String HOST = "email-smtp.us-west-2.amazonaws.com";
const int PORT = 25;//already tried with all recommended ports
SmtpClient client = new SmtpClient(HOST, PORT);
client.Credentials = new System.Net.NetworkCredential(SMTP_USERNAME, SMTP_PASSWORD);
client.EnableSsl = true;
try
{
Console.WriteLine("Attempting to send an email through the Amazon SES SMTP interface...");
client.Send(FROM, TO, SUBJECT, BODY);
Response.Write("ENVIADO");
}
catch (Exception ex)
{
Response.Write("<br>O e-mail não foi enviado.<br>");
Response.Write("Olhao erro: " + ex.Message);
}
}
catch (Exception ex)
{
Response.Write("Error message: " + ex.Message);
}
}
【问题讨论】:
标签: c# asp.net email amazon-web-services amazon-ses