I am creating a page with contact details, and I want to receive mail from this page, since its mail was sent from the user's mail.
I wrote this code:
var client = new SmtpClient("smtp.gmail.com", 587)
{
Credentials = new NetworkCredential("mymail@gmail.com", "password"),
EnableSsl = true
};
MailMessage mail = new MailMessage();
mail.From = new MailAddress("userEmail@any.com");
mail.To.Add(new MailAddress("mymail@gmail.com"));
mail.Body = "bodyTest";
mail.Subject = "subjectTest";
client.Send(mail);
But I get mail from my mail, not from the user
How to do it?
source
share