码迷,mamicode.com
首页 > Web开发 > 详细

Sending Email In .NET Core 2.0

时间:2018-10-12 11:58:22      阅读:225      评论:0      收藏:0      [点我收藏+]

标签:message   bsp   ble   win   and   att   als   get   enc   

Consider the following written in .NET Core 2.0.

 1             SmtpClient client = new SmtpClient("smtp.exmail.qq.com", 587)
 2             {
 3                 UseDefaultCredentials = true,
 4                 Credentials = new NetworkCredential("test@kzwr.com", "yHbgby"),
 5                 EnableSsl = true
 6             };
 7 
 8             MailMessage mailMessage = new MailMessage("test@kzwr.com", "10001@qq.com")
 9             {
10                 Body = "<h1>body</h1>",
11                 Subject = "subject",
12                 BodyEncoding = Encoding.UTF8,
13                 IsBodyHtml = true
14             };
15 
16             client.Send(mailMessage);
17 
18             client.Dispose();
19             mailMessage.Dispose(); 

 

 For the most part, if you had code that could send email via SMTP in the full framework, it’s likely a matter of a copy and paste job to get it going in .NET Core now!

Sending Email In .NET Core 2.0

标签:message   bsp   ble   win   and   att   als   get   enc   

原文地址:https://www.cnblogs.com/kzwrcom/p/9777060.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!