Send an Email via SMTP with C#
By Jason, 11.01.07 @ 1:22 pm :: .NET
For whatever reason the web is filled with outdated examples of sending email with C#. This an example using .NET 2.0
First, be sure to import the Mail libs at the top of your class:
using System.Net.Mail;
Then in your code where the email will be sent:
MailMessage msg = new MailMessage();
msg.From = new MailAddress("from@address.com");
msg.To.Add(new MailAddress("to@address.com"));
msg.Subject = [...]