提前感谢您的帮助!
我想要它,所以当 A@gmail.com 收到电子邮件时,它似乎来自 B@gmail.com。我相信这会起作用,但它似乎仍然来自 A@gmail.com。我尝试使用ReplytoList/Headers,但如果没有任何帮助,将不胜感激。
using (var client = new SmtpClient
{
Host = "smtp.gmail.com",
Port = 587,
EnableSsl = true,
Credentials = new NetworkCredential("A@gmail.com", "$$$$$"),
DeliveryMethod = SmtpDeliveryMethod.Network
})
{
var mail = new MailMessage();
mail.To.Add(new MailAddress("A@gmail.com"));
mail.From = new MailAddress("B@gmail.com");
mail.Subject = String.Format("Request to Contact from {0}", form.CompanyName);
mail.Body = form.Message;
mail.IsBodyHtml = false;
try
{
client.Send(mail);
retValue = "Your Request for Contact was submitted successfully. We will contact you shortly.";
}
catch (Exception)
{
throw;
}