title: How to set From Address to any email other gmail in ( Sending Email in .NET Through Gmail )?
body: <p>In this post <a href="https://stackoverflow.com/questions/32260/sending-email-in-net-through-gmail">Sending Email in .NET Through Gmail</a> we have a code to send email through gmail, in the send mail we find from Field contain gmail account that I used<br>
  I use the same code but by changing the From Address to any email I want ans set gmail address in Credentials as bellow</p>
  
  <pre><code>var fromAddress = new MailAddress("AnyEmai@mailserver.com", "From Name");
  var toAddress = new MailAddress("to@example.com", "To Name");
  const string fromPassword = "fromPassword";
  const string subject = "Subject";
  const string body = "Body";
  
  var smtp = new SmtpClient
             {
                 Host = "smtp.gmail.com",
                 Port = 587,
                 EnableSsl = true,
                 DeliveryMethod = SmtpDeliveryMethod.Network,
                 UseDefaultCredentials = false,
                 Credentials = new NetworkCredential("from@gmail.com", fromPassword)
             };
  using (var message = new MailMessage(fromAddress, toAddress)
                       {
                           Subject = subject,
                           Body = body
                       })
  {
      smtp.Send(message);
  }
  </code></pre>
  
  <p>But in the sent email gmail account still appear in From Address and <code>AnyEmai@mailserver.com</code> not appear ... is there any way to do that ?</p>