Ami*_*rge 13 c# smtp amazon-web-services amazon-ses
.Net SmtpClient的Send方法返回void.它只抛出两个异常,SmtpException和FailureToSendToRecipientsException(或类似的东西).
使用SES时,为了成功发送电子邮件,SES会发回带有消息ID的200 OK消息.需要跟踪此消息ID.
如何使用C#SMTP api执行此操作?
编辑:SMTP协议提到SMTP服务器发送的各种响应代码.我正在寻找一个SMTP库,向调用者公开"最终"响应代码.我已经知道SES HTTP API了.我暂时不打算使用它.
您是否尝试过Amazon SES(简单电子邮件服务)C# 包装器?
它有一个 SendEmail 方法,该方法返回带有 MessageId 的类:
public AmazonSentEmailResult SendEmail(string toEmail, string senderEmailAddress, string replyToEmailAddress, string subject, string body)
{
List<string> toAddressList = new List<string>();
toAddressList.Add(toEmail);
return SendEmail(this.AWSAccessKey, this.AWSSecretKey, toAddressList, new List<string>(), new List<string>(), senderEmailAddress, replyToEmailAddress, subject, body);
}
public class AmazonSentEmailResult
{
public Exception ErrorException { get; set; }
public string MessageId { get; set; }
public bool HasError { get; set; }
public AmazonSentEmailResult()
{
this.HasError = false;
this.ErrorException = null;
this.MessageId = string.Empty;
}
}
Run Code Online (Sandbox Code Playgroud)
我认为您无法根据 Amazon SES 示例获取System.Net.Mail.SmtpClient需要使用的
MessageId : http://docs.aws.amazon.com/ses/latest/DeveloperGuide/send-using-smtp-net.htmlAmazon.SimpleEmail.AmazonSimpleEmailServiceClient
| 归档时间: |
|
| 查看次数: |
1736 次 |
| 最近记录: |