请参阅下面我尝试过的代码片段。
在我的应用程序中,当我输入无效的电子邮件地址时,我没有在 Outlook 中收到退回电子邮件。
MailMessage message = new MailMessage("noreply@mail.CLIENTURL.extra.org", strTo);
message.Subject = strSubject;
message.IsBodyHtml = true;
message.ReplyTo = new MailAddress("consult@mail.CLIENTURL.extra.org") ;
message.DeliveryNotificationOptions = DeliveryNotificationOptions.OnFailure | DeliveryNotificationOptions.OnSuccess | DeliveryNotificationOptions.Delay;
message.Headers.Add("Return-Path", "consult@mail.CLIENTURL.extra.org");
message.AlternateViews.Add(strBody);
if (strAttachment != "")
{
Attachment At = new Attachment(strAttachment);
message.Attachments.Add(At);
}
message.Priority = MailPriority.High;
SmtpClient smtpClient = new SmtpClient(ConfigurationSettings.AppSettings["SmtpServer"]);
smtpClient.UseDefaultCredentials = true;
smtpClient.Send(message);
这段代码中有什么我遗漏的吗?
需要帮忙。
谢谢,