gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-11-30 14:41:50 25 4
gpt4 key购买 nike

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

我正在使用 System.Net.Mail。

最佳答案

将 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("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);
}

关于c# - 有没有办法知道电子邮件是否已通过 C# 成功中继?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3734520/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com