static void Main(string[] args) { SmtpHost host = new SmtpHost() { Host = "smtp.somesite.com", Port = 25 }; SmtpLogin credentials = new SmtpLogin() { Username = "******", Password = "******" }; using (SmtpSocket auth = new SmtpSocket(host)) { auth.Connect(); if (auth.Authenticate(credentials)) { Console.WriteLine("Logged in"); } else { Console.WriteLine("Failed"); } } Console.WriteLine(" == Program Executed == "); Console.ReadLine(); }
public SmtpSocket(SmtpHost smtp) { this.smtp = smtp; this.socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); }