Darshan Joshi

Darshan Joshi

  • NA
  • 15
  • 27.4k

In mail sender name is overwrite

Feb 29 2012 12:54 AM
sir when ever i send mail from .net application the snder name is overwtite what is problem?????
rply fast.......................................
my code is here

 MailMessage email = new MailMessage();

  email.Subject = "My first test email";
  email.SubjectEncoding = System.Text.Encoding.UTF8;
  email.Body = "Name:=" + txtfrstname.Text + "<br/>" + "Last Name:=" + txtlastname.Text + "<br/>" + "E-Mail Id:=" + txtmailid.Text + "<br/>" + "Phone:=" + txtphone.Text + "<br/>" + "Comment:=" + txtmail.Text;
  email.BodyEncoding = System.Text.Encoding.UTF8;
  email.To.Add(new MailAddress("[email protected]"));
  email.IsBodyHtml = true;
  email.Sender = new MailAddress("[email protected]");
  email.From = new MailAddress("[email protected]");
 
  //email.Attachments.Add(new Attachment("c:\\my-attachment.pdf"));

  try
  {
  SmtpClient client = new SmtpClient();
  client.Credentials = new System.Net.NetworkCredential("[email protected]", "12345789");
  client.Port = 587;
  client.Host = "smtp.gmail.com";
  client.EnableSsl = true;
 
  //  25 is the default SMTP port
  client.Send(email);
  }
  catch (SmtpException ex)
  {

  }