2010-09-17 91 views

回答

2

将MailMessage的DeliveryNotificationOptions属性设置为
System.Net.Mail.DeliveryNotificationOptions.OnSuccess;

或尝试:

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

//set the addresses 
mail.From = new MailAddress("[email protected]"); 
mail.To.Add("[email protected]"); 

//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 '[email protected]' 
//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", "<[email protected]>"); 


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

我可以设置多个DeliveryNotificationOptions吗?谢谢。 – gaurav 2010-09-17 12:03:22

+0

@gaurav - 没有试过那个 – 2010-09-17 12:07:28

+1

许多服务器 - 尤其是企业服务器 - 阻止传送报告,因为它们揭示了哪些电子邮件地址是有效的,因此可能导致垃圾邮件。 – 2010-09-17 12:32:55

2

知道某人是否收到电子邮件的唯一方法是让他们以某种方式通知您(阅读收件人或类似内容)。

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

+0

这是确定的,但有时会同时注册,如果用户没有收到确认电子邮件(以链接激活帐户的电子邮件),我们怎么能知道这件事,因为我没有从SmtpClient类方法中得到任何异常。 – gaurav 2010-09-17 10:33:49

+1

您无法知道他们是否收到了邮件,即使邮件从您的服务器发送出去,它可能会在途中丢失(包括他的电子邮件提供商可能因某种原因已将您的电子邮件提供商列入黑名单,并自动删除所有电子邮件)。我建议在用户注册之后,如果您在x分钟内没有收到邮件,请在邮件中显示“'”,请检查您的垃圾邮件文件夹,或尝试重新发送邮件,或重新发送邮件至另一个电子邮件地址“'。 – 2010-09-17 10:40:02

2

使用服务,如Postmark,它允许您通过smtp或api发送,并可以使用Web钩子通知您的应用程序失败的消息。

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

相关问题