Hi,
I am sending the information I collected from my 'Contact Us' page to my email which is supported by google apps.
When I receive the email from the website I want to see the email id of the sender in FROM which was entered in txtEmail.Text.
m.From = new System.Net.Mail.MailAddress(txtEmail.Text, txtName.Text);
But this is not happening. When I receive the email in From, I am getting "[email protected]".
How can I correct it?
System.Net.NetworkCredential c = new System.Net.NetworkCredential();
c.Password = "my_Credential_Password";
c.UserName = "[email protected]";
System.Net.Mail.MailMessage m = new System.Net.Mail.MailMessage();
m.From = new System.Net.Mail.MailAddress(txtEmail.Text, txtName.Text);
m.To.Add("[email protected]");
m.Headers.Add("Reply-To", txtEmail.Text);
m.Subject = "My Website Enquiry: " + txtSubject.Text;
m.Body = txtBody.Text;
m.IsBodyHtml = false;
System.Net.Mail.SmtpClient s = new System.Net.Mail.SmtpClient();
s.UseDefaultCredentials = false;
s.Credentials = c;
s.DeliveryMethod = System.Net.Mail.SmtpDeliveryMethod.Network;
s.EnableSsl = true;
s.Port = 587;
s.Host = "smtp.gmail.com";
s.Send(m);
Thanks,