您现在的位置是:主页 > news > 网站解析密码/seo网址大全
网站解析密码/seo网址大全
admin2025/4/27 0:04:25【news】
简介网站解析密码,seo网址大全,saas自助建站,wordpress迁移打不开这里用QQ邮箱做样例 点击设置,点击账户,往下滑 把这里全都打开,然后一会下面代码中的授权码,就是这个页面中的生成授权码 using System; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Mai…
网站解析密码,seo网址大全,saas自助建站,wordpress迁移打不开这里用QQ邮箱做样例
点击设置,点击账户,往下滑
把这里全都打开,然后一会下面代码中的授权码,就是这个页面中的生成授权码
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Mai…
这里用QQ邮箱做样例
点击设置,点击账户,往下滑
把这里全都打开,然后一会下面代码中的授权码,就是这个页面中的生成授权码
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Mail;
using System.Net.Mime;
using System.Web;namespace youxiangyanzhneg
{public class SendQQEmail{//实例化一个发送邮件类。private static MailMessage mailMessage = new MailMessage();public static bool QQ_email(){//发件人邮箱地址,方法重载不同,可以根据需求自行选择。mailMessage.From = new MailAddress("发件人邮箱", "发件人的名称");//收件人邮箱地址。mailMessage.To.Add(new MailAddress("收件人邮箱"));//邮件标题。mailMessage.Subject = "邮箱验证码";//邮件内容。mailMessage.Body = "验证码为:123456";//添加到附件中 这里的附件,每个附件之间使用 , 分开AddAnnex($"D:/Android文件/1e9d9bbf-595b-49ed-bbbf-1e2a1e48c79e.png");//实例化一个SmtpClient类。SmtpClient client = new SmtpClient();//在这里我使用的是qq邮箱,所以是smtp.qq.com,如果你使用的是126邮箱,那么就是smtp.126.com。client.Host = "smtp.qq.com";//使用安全加密连接。client.EnableSsl = true;//不和请求一块发送。client.UseDefaultCredentials = false;//验证发件人身份(发件人的邮箱,邮箱里的生成授权码);client.Credentials = new NetworkCredential("发件人的邮箱", "邮箱的授权码");//发送client.Send(mailMessage);return true;}private static void AddAnnex(string Path){string[] path = Path.Split(',');Attachment data;ContentDisposition disposition;for (int i = 0; i < path.Length; i++){data = new Attachment(path[i], MediaTypeNames.Application.Octet);//实例化附件 disposition = data.ContentDisposition;disposition.CreationDate = System.IO.File.GetCreationTime(path[i]);//获取附件的创建日期 disposition.ModificationDate = System.IO.File.GetLastWriteTime(path[i]);//获取附件的修改日期 disposition.ReadDate = System.IO.File.GetLastAccessTime(path[i]);//获取附件的读取日期 mailMessage.Attachments.Add(data);//添加到附件中 }}}
}
然后使用代码直接调用
SendQQEmail.QQ_email();
运行的效果图