在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
安装Package:
使用下面的代码发送: 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); } }
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论