Here is the C# version of Sending Email in ASP.NET 2.0 (VB.NET).
using System.Net.Mail;
The code snippet demonstrates Larry King emailing Oprah.
MailMessage Message = new MailMessage(); SmtpClient Smtp = new SmtpClient(); // Build message Message.From = new MailAddress("larryking@cnn.com", "Larry King"); Message.To.Add(new MailAddress("oprah@oprah.com", "Oprah")); Message.IsBodyHtml = false; Message.Subject = "Come on My Show Soon"; Message.Body = "Please be a guest on my show. - Larry"; // Send Message // each web host is different // (adjust next 2 lines accordingly) Smtp.Host = "localhost"; Smtp.DeliveryMethod = SmtpDeliveryMethod.Network; Smtp.Send(Message);
