【发布时间】:2016-07-15 22:37:37
【问题描述】:
我正在尝试为我的电子邮件设置“返回路径”,但我没有将其视为可用参数。似乎回复列表不是一回事。我不想设置退回电子邮件的发送位置。到目前为止,这是我的代码:
private static void SendMail(string html,string taxId,string toEmail,string filePath,string fromEmail,string replyToEmail,string emailSubject,string emailAttachPath)
{
try
{
MailMessage mail = new MailMessage();
mail.From = new MailAddress(fromEmail);
mail.To.Add(toEmail);
mail.Subject = emailSubject;
mail.Body = html;
//specify the priority of the mail message
mail.ReplyToList.Add(replyToEmail);
SmtpClient SmtpServer = new SmtpClient("smtp.server.com");
SmtpServer.Port = 25;
SmtpServer.UseDefaultCredentials = true;
SmtpServer.EnableSsl = false;
mail.IsBodyHtml = true;
SmtpServer.Send(mail);
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
}
}
【问题讨论】:
-
This question 可能会有所帮助。
-
我按照建议设置了发件人属性,但我仍然没有收到退回到发件人电子邮件地址的电子邮件。 IT 团队说这是因为我没有设置“返回路径”。
-
Here's another question 关于这个主题。答案与前面的评论基本一致。您使用的是什么 SMTP 服务器?可能是服务器的配置问题?您可以使用 Outlook(例如)通过此服务器发送消息吗?使用 Outlook(或其他电子邮件客户端)时,退回的邮件会返回给您吗?
标签: c# email smtp return-path