0

提前感谢您的帮助!

我想要它,所以当 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;
                }
4

1 回答 1

1

这是因为您需要将B@gmail.comin 作为备用电子邮件地址添加到您的A@gmail.com帐户中,否则 gmail smtp 服务器不会让您欺骗电子邮件地址。

在此处输入图像描述

于 2013-08-30T21:27:04.920 回答