baskaran chellasamy

baskaran chellasamy

  • NA
  • 114
  • 150.5k

send mail in contact us form

Mar 23 2013 7:17 AM
Hi friends
 
The following is my code for sending email in contact us page of my website.
      System.Net.Mail.MailMessage msg = new System.Net.Mail.MailMessage();
                msg.From = new MailAddress(emailid.Text);
                msg.To.Add("[email protected]");
                msg.Subject = subject.Text;
                msg.Body = txtBody.Text;
                SmtpClient smtp = new SmtpClient();
                smtp.Host = "smtp.gmail.com";
                smtp.Port = 587;
                smtp.Credentials = new System.Net.NetworkCredential("[email protected]", "mygmailpassword");
                smtp.EnableSsl = true;
                smtp.Send(msg);
          
in my inbox of [email protected], i just received the message from [email protected]. but i want to get mail from email.txt(where somebody enter their email id).how can change that thing.

Answers (2)