I believe that I will simply post a collaborative message effort here:
Add this to your configuration file by changing the email address / username / password. You may need to change the port based on what Brian Rogers published.
<system.net> <mailSettings> <smtp from=" some.user@gmail.com " deliveryMethod="Network"> <network host="smtp.gmail.com" port="587" enableSsl="true" userName=" some.user@gmail.com " password="mypassword"/> </smtp> </mailSettings> </system.net>
Use this in your code
MailMessage mail = new MailMessage(); mail.To.Add(" to@gmail.com "); mail.From = new MailAddress(" from@gmail.com "); mail.Subject = "Test Email"; string Body = "<b>Welcome to CodeDigest.Com!!</b>"; mail.Body = Body; mail.IsBodyHtml = true; SmtpClient smtp = new SmtpClient(); smtp.Send(mail);
source share