2010-09-17 44 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,但郵戳包裝很好。

相關問題