
Untitled
By: a guest on
Jul 20th, 2012 | syntax:
None | size: 0.58 KB | hits: 16 | expires: Never
Identifying senders email id while trying to contact the company through Contact Us form
MailMessage mail = new MailMessage();
mail.From = new MailAddress(txtEmail.Text);
mail.To.Add("sales@mycompany.in");
mail.Subject = "Mail from www.mycompany.in";
mail.Body = emailbody.ToString();
mail.IsBodyHtml = true;
SmtpClient smtp = new SmtpClient();
smtp.Host = "smtp.gmail.com"; //Or Your SMTP Server Address
smtp.Credentials = new System.Net.NetworkCredential
("mycompany@gmail.com", "xxxxxx");
//Or your Smtp Email ID and Password
// smtp.Port=80;
smtp.EnableSsl = true;
smtp.Send(mail);