我正在尝试为我的电子邮件设置“返回路径”,但我没有将其视为可用参数。似乎回复者不是一回事。我不想设置退回电子邮件的位置。到目前为止,这是我的代码:
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());
}
}