// Example 1: Send an email message using SMTP using System.Net.Mail; var client = new SmtpClient("smtp.example.com", 25); client.EnableSsl = true; client.Credentials = new NetworkCredential("username", "password"); var message = new MailMessage("[email protected]", "[email protected]", "Subject", "Body"); client.Send(message); // Example 2: Dispose of the SmtpClient object manually using System.Net.Mail; var client = new SmtpClient("smtp.example.com", 25); client.EnableSsl = true; client.Credentials = new NetworkCredential("username", "password"); var message = new MailMessage("[email protected]", "[email protected]", "Subject", "Body"); client.Send(message); client.Dispose(); // release unmanaged resourcesThe SmtpClient class is part of the System.Net.Mail package library in the .NET Framework.