有没有办法用C#知道电子邮件是否成功中继?
我正在使用System.Net.Mail。
我正在使用System.Net.Mail。
System.Net.Mail.DeliveryNotificationOptions.OnSuccess
;
或者尝试: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);
}
要确定某人是否收到了一封电子邮件,唯一的方法是要求他们以某种方式通知您(如读取回执或类似方式)。
这就是为什么所有的电子邮件确认方案都需要您点击链接确认它是您的电子邮件的原因。