Install the package:
Install-package AIM
Use the following code to send:
Class mail{private static string mailaddress = "{You email address}"; private static string host = "{Your host server}"; private static string UserName = "{Your user name}"; private static string Password = "{Your password}"; private static string Userto = "{to address}"; private static void SendEmail (string subject, String message) {//generate message var mailmessage = new Mimemailmessage (); Mailmessage.from = new Mimemailaddress (mailaddress); MAILMESSAGE.TO.ADD (Userto); Mailmessage.subject = Subject; mailmessage.body = message; Create SMTP Client var mailer = new Mimemailer (host, 465); Mailer. User = UserName; Mailer. Password = Password; Mailer. Ssltype = Sslmode.ssl; Mailer. Authenticationmode = authenticationtype.base64; Set a delegate function for call back mailer. sendcompleted + = compevent; Mailer. Sendmailasync (MailMessage); }//call back Function private static void Compevent (object sender, AsyncCompletedEventArgs e) {if (e.userstate! = null) Console.Out.WriteLine (E.userstate.tostring ()); Console.Out.WriteLine ("Is it canceled?" + e.cancelled); if (e.error! = null) Console.Out.WriteLine ("Error:" + e.error.message); }}
Send mail with C # support implicit SSL