I think that Gmail is rewriting the from address and using the account that is provided in the network credentials for the from.
MailMessage message = new MailMessage();
message.From = new MailAddress("[email protected]");
message.To.Add(new MailAddress("[email protected]"));
message.Subject = "[Yep] Contact Form";
message.Body = msg;
message.IsBodyHtml = false;
SmtpClient client = new SmtpClient();
client.UseDefaultCredentials = false;
NetworkCredential networkCredentials = new NetworkCredential("[email protected]", "pass");
client.Credentials = networkCredentials;
client.EnableSsl = true;
client.Host = "smtp.gmail.com";
client.Port = 587;
try
{
client.Send(message);
This is the received email:
From: [email protected] To: [email protected] Date: Sun, 23 Sep 2012 14:44:54 -0700 (PDT) Subject: [Yep] Contact Form Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable
This is a test
I know it use to work but now the from is always mine. Can I get a confirmation if everyone else is having this issue or is it just me?
GMail (and many other email providers) will not allow you to alter the FROM header. That would allow email spoofing.