1:开通个人smtp: 2:账户下开通smtp: 会发短信收到授权码:smurdizujnjgcacj(留着有用);3:干活来了:(代码比较简单)var client = new SmtpClient(smtp.qq.com) { Enabl...
1:开通个人smtp:
2:账户下开通smtp:
会发短信收到授权码:smurdizujnjgcacj(留着有用);
3:干活来了:(代码比较简单)
var client = new SmtpClient("smtp.qq.com")
{
EnableSsl = true,
UseDefaultCredentials = false,
Credentials = new System.Net.NetworkCredential("1632694570@qq.com", "smurdizujnjgcacj")
};
MailAddress from = new MailAddress("1632694570@qq.com", "磅管家科技", Encoding.UTF8);//初始化发件人
MailAddress to = new MailAddress("953706194@qq.com", "雷榕", Encoding.UTF8);//初始化收件人
////设置邮件内容
MailMessage message = new MailMessage(from, to)
{
Body = "测试",
BodyEncoding = Encoding.UTF8,
Subject = "测试",
SubjectEncoding = Encoding.UTF8,
IsBodyHtml = true
};
client.Send(message);
完成!
本文标题为:.net core 个人 smtp服务 邮件发送
基础教程推荐
- C#类和结构详解 2023-05-30
- C# List实现行转列的通用方案 2022-11-02
- C# 调用WebService的方法 2023-03-09
- C#控制台实现飞行棋小游戏 2023-04-22
- 一个读写csv文件的C#类 2022-11-06
- C# windows语音识别与朗读实例 2023-04-27
- winform把Office转成PDF文件 2023-06-14
- linux – 如何在Debian Jessie中安装dotnet core sdk 2023-09-26
- ZooKeeper的安装及部署教程 2023-01-22
- unity实现动态排行榜 2023-04-27