Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jul 20th, 2012  |  syntax: None  |  size: 0.58 KB  |  hits: 16  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Identifying  senders email id while trying to contact the company through Contact Us form
  2. MailMessage mail = new MailMessage();
  3. mail.From = new MailAddress(txtEmail.Text);
  4. mail.To.Add("sales@mycompany.in");
  5. mail.Subject = "Mail from www.mycompany.in";
  6. mail.Body =  emailbody.ToString();
  7. mail.IsBodyHtml = true;
  8. SmtpClient smtp = new SmtpClient();
  9. smtp.Host = "smtp.gmail.com"; //Or Your SMTP Server Address
  10. smtp.Credentials = new System.Net.NetworkCredential
  11. ("mycompany@gmail.com", "xxxxxx");
  12. //Or your Smtp Email ID and Password
  13. // smtp.Port=80;
  14. smtp.EnableSsl = true;
  15. smtp.Send(mail);