分享web开发知识

注册/登录|最近发布|今日推荐

主页 IT知识网页技术软件开发前端开发代码编程运营维护技术分享教程案例
当前位置:首页 > 网页技术

Sending Email In .NET Core 2.0

发布时间:2023-09-06 02:17责任编辑:沈小雨关键词:.NET

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 = true14 ????????????};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

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

知识推荐

我的编程学习网——分享web前端后端开发技术知识。 垃圾信息处理邮箱 tousu563@163.com 网站地图
icp备案号 闽ICP备2023006418号-8 不良信息举报平台 互联网安全管理备案 Copyright 2023 www.wodecom.cn All Rights Reserved