0
Reply

In mail sender name is overwrite

Darshan Joshi

Darshan Joshi

Feb 29 2012 12:54 AM
1.3k
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)
  {

  }