是否可以设置不同的电子邮件以在C#中接收传递状态通知?我尝试设置ReplyToList,但没有按照我想要的方式工作。 我使用gmail提供程序。
MailMessage emailMessage = new MailMessage();
emailMessage.From = new MailAddress("myacc@gmail.com");
emailMessage.To.Add(new MailAddress("accto@gmail.com"));
emailMessage.Subject = "SUBJECT";
emailMessage.Body = "BODY";
emailMessage.Priority = MailPriority.Normal;
SmtpClient MailClient = new SmtpClient("smtp.gmail.com", 587);
MailClient.EnableSsl = true;
MailClient.Credentials = new System.Net.NetworkCredential("myacc@gmail.com", "mypass");
MailClient.Send(emailMessage);
如果在其他问题中存在或不存在此标题,则没有明确的答案。
答案 0 :(得分:1)
它通常声称实现这一目标的方式是
mailMessage.DeliveryNotificationOptions = DeliveryNotificationOptions.OnSuccess | DeliveryNotificationOPtions.OnFailure;
mailMessage.AddHeaderField( "Return-Receipt-To" , "\"John Doe\" <johnDoe@blahblahblah.com>" );
mailMessage.AddHeaderField( "Disposition-Notification-To" , "\"John Doe\" <johnDoe@blahblahblah.com>" );
但无法保证邮件服务器或收件人能够遵守该请求。
Disposition-Notification-To
标头字段是标准方式,Return-Receipt-To
是非标准方式。