MailMessage email = new MailMessage();
email.From = new MailAddress("account@gmail.com");
email.To.Add("account@gmail.com");
email.CC.Add(new MailAddress("account@gmail.com"));
email.Subject = "Website Contact";
email.IsBodyHtml = true;
email.Body = "<strong>Email:</strong> " + txtEmail.Text;
NetworkCredential smtpUserInfo = new NetworkCredential("account@gmail.com", "yourpassword");
SmtpClient smtp = new SmtpClient("smtp.gmail.com");
smtp.UseDefaultCredentials = false;
smtp.EnableSsl = true;
smtp.Port = 465;
smtp.Credentials = smtpUserInfo;
smtp.Send(email);
Currently rated 5.0 by 2 people
- Currently 5/5 Stars.
- 1
- 2
- 3
- 4
- 5