有没有办法知道电子邮件是否成功通过C#中继?

时间:2010-09-17 10:27:27

标签: c# email c#-2.0

有没有办法知道电子邮件是否通过C#成功转发?

我正在使用System.Net.Mail。

3 个答案:

答案 0 :(得分:2)

只有知道某人是否收到电子邮件的方法是要求他们以某种方式告知您(阅读收据或类似信息)。

这就是为什么所有电子邮件确认方案始终都需要您点击链接以确认它是您的电子邮件。

答案 1 :(得分:2)

使用Postmark之类的服务,它允许您通过smtp或api发送,并可以使用网络连接通知您的应用程序失败的消息。

邮戳使用PowerMTA,一个能够检测垃圾标记,反弹等的电子邮件网关。您可以直接通过PowerMTA,但邮戳可以很好地包装它。

答案 2 :(得分:2)

将MailMessage DeliveryNotificationOptions属性设置为

或尝试:

static void ReadReceipts()
{
//create the mail message
MailMessage mail = new MailMessage();

//set the addresses
mail.From = new MailAddress("me@mycompany.com");
mail.To.Add("you@yourcompany.com");

//set the content
mail.Subject = "This is an email";
mail.Body = "this is the body content of the email.";

//To request a read receipt, we need add a custom header named 'Disposition-Notification-To'
//in this example, read receipts will go back to 'someaddress@mydomain.com'
//it's important to note that read receipts will only be sent by those mail clients that 
//a) support them
//and
//b)have them enabled.
mail.Headers.Add("Disposition-Notification-To", "<someaddress@mydomain.com>");


//send the message
SmtpClient smtp = new SmtpClient("127.0.0.1");
smtp.Send(mail);
}