当前位置: 首页 > news >正文

无线路由器做中继手机能连接但无法访问网站彩票自己开盘做网站

无线路由器做中继手机能连接但无法访问网站,彩票自己开盘做网站,wordpress建站 app访问,东莞建设质监网站背景利用代码发送邮件在工作中还是比较常见的#xff0c;相信大家都用过SmtpClient来处理发送邮件的操作#xff0c;不过这个类以及被标记已过时#xff0c;所以介绍一个微软推荐的库MailKit来处理。MailKit开源地址#xff1a;https://github.com/jstedfast/MailKit需要邮…背景利用代码发送邮件在工作中还是比较常见的相信大家都用过SmtpClient来处理发送邮件的操作不过这个类以及被标记已过时所以介绍一个微软推荐的库MailKit来处理。MailKit开源地址https://github.com/jstedfast/MailKit需要邮件功能1、服务提供方:需提供邮件收发客户端或Web服务。如:QQ邮箱、GMail邮箱、126、163等知名邮件服务提供商。注:如果你使用的第三方不知名邮件服务商提供的邮件收发服务,通过其发出的邮件,可能会被其他知名邮件服务提供商的STMP服务器视为是恶意邮件或垃圾邮件!2、消息推送:消息推送方3、App:某些网站会员的注册功能或者功能激活功能。协议1、SMTP(Simple Mail Transfer Protocol)   ---简单邮件传输协议2、POP3(Post Office Protocol -Version3)   ---邮局协议第三个版本代码实现1、新建项目 引用 MailKitusing MailKit.Net.Smtp;using MimeKit;2、指定发件人、收件人、附件等信息[HttpPost][Route(sendmail)]public bool Sendmail(SendmailDto model){string mailTo model.mail;string title model.title;string requestId Guid.NewGuid().ToString(N);string path WriteFilepath(requestId, title .html, model.str);string docpath path.Replace(.html, .docx);try{string applicationRoot AppContext.BaseDirectory;var provider new PhysicalFileProvider(applicationRoot);string apath C:/www/fengnan;// string apath C:/net6.0;var filePath //applicationRoot apath $/Template/fldoc/ requestId /;var filePath2 //applicationRoot apath $/Template/fldoc/ requestId / title .html;ecmd(soffice --headless --convert-to docx:\Office Open XML Text\ filePath2 --outdir filePath);// string docpath path.Replace(.html, .docx);}catch (Exception ex){_logger.Error(ex);}// string mailFrom xxxxqq.com;string mailFrom xxxxx.net;// mailTo xxxxx.com;string Text 内容见附件请查收br/ 感谢;string mailFromAccount xxxqq.com;string mailPassword xxxx;string mailFromAccount xxxxx.net;string mailPassword xxxx;var contentRoot Directory.GetCurrentDirectory();var webRoot Path.Combine(contentRoot, wwwroot);/// string path Path.Combine(webRoot, Images/icc.png);// string path D:\xxxx知.html;// string Text Hey Chandler,//I just wanted to let you know that Monica and I were going to go play some paintball, you in?//-- Joey;Config eConfig new Config{ From new MailAddress(xxxx, mailFrom),// Host smtp.qq.com, Host smtp.exmail.qq.com, MailFromAccount mailFromAccount, MailPassword mailPassword,// Port 587, Port 465, UseSsl true, IsHtml true};ListMailAddress tos new ListMailAddress();tos.Add(new MailAddress(, mailTo));Liststring flist new Liststring();if (System.IO.File.Exists(docpath)){flist.Add(docpath);//docpath}else{flist.Add(path);}Mailhelper.SendEmail(eConfig, tos, title, Text, flist.ToArray());return true;}3、发邮件帮助类using MimeKit; using System.Collections.Generic; using System.IO; using System.Text; using System.Threading.Tasks; namespace DFTech.Service.Filters {/// summary/// 发邮件/// /summarypublic class Mailhelper{/// summary/// 发邮件/// /summary/// param nameconfig/param/// param nametos/param/// param namesubject/param/// param namemessage/param/// param nameattachments/param/// returns/returnspublic static void SendEmail(Config config, ListMailAddress tos, string subject, string message, params string[] attachments){var emailMessage new MimeMessage();emailMessage.From.Add((MailboxAddress)config.From);foreach (var to in tos)emailMessage.To.Add(to as MailAddress);emailMessage.Subject subject;var alternative new Multipart(alternative);if (config.IsHtml)alternative.Add(new TextPart(html) { Text message });elsealternative.Add(new TextPart(plain) { Text message });if (attachments ! null){foreach (string f in attachments){var attachment new MimePart()//(image, png){ContentObject new ContentObject(File.OpenRead(f), ContentEncoding.Default),ContentDisposition new ContentDisposition(ContentDisposition.Attachment),ContentTransferEncoding ContentEncoding.Base64,FileName Path.GetFileName(f)};alternative.Add(attachment);}}emailMessage.Body alternative;using (var client new SmtpClient()){client.Connect(config.Host, config.Port, config.UseSsl);// SecureSocketOptions.Noneclient.AuthenticationMechanisms.Remove(XOAUTH2);client.Authenticate(config.MailFromAccount, config.MailPassword);client.Send(emailMessage);client.Disconnect(true);}}}public class Config{public int Port { get; set; } 25; //25public string Host { get; set; } //smtp.hantianwei.cnpublic bool IsHtml { get; set; } true;public bool UseSsl { get; set; } false;public string MailFromAccount { get; set; }//mailhantianwei.cnpublic string MailPassword { get; set; }public MailAddress From { get; set; }}/// summary////// /summarypublic class MailAddress : MailboxAddress{public MailAddress(string name, string address) : base(name, address){}public MailAddress(Encoding encoding, string name, string address) : base(encoding, name, address){}} }
http://www.pierceye.com/news/341331/

相关文章:

  • 网站开发考试题torrentkitty磁力猫引擎
  • 如何把电脑改成服务器 做网站微信网站背景图片
  • 淘宝客网站建设详细教程链接交换平台
  • 外贸门户网站深圳网站制作开发排名
  • 如何建设一个稳定的网站photoshop网页制作视频教程
  • 企业网站建设合作合同28招商加盟网
  • 国外设计灵感网站WordPress数据库添加管理员
  • 山东省建设备案网站审批表免费设计手写签名
  • 家庭电脑做网站深圳罗湖网站制作公司
  • 聊城做wap网站服务有哪些做特卖的网站有哪些
  • wordpress後台建站flash美食网站论文
  • 网站服务器ip地址在哪里看用记事本做电影介绍的网站
  • 重庆企业建站公司沧浪企业建设网站价格
  • 免费建单页网站厂房出租做推广什么网站好
  • jquery网站模板下载做的网站显示不了背景图片
  • 图书管理系统网站开发教程怎么创建自己的网址
  • 网站网站是怎么做的专业app开发制作团队
  • 平顺网站建设应届生在淮北招的网站建设类型岗位
  • 手机网站模板尺寸wordpress5.1更新
  • 微网站设计教育培训机构官网
  • 搭建论坛网站福州工程网站建设团队
  • 易语言跳到指定网站怎么做商业网站建设方案
  • 专业的饰品行业网站开发杭州市建设厅网站
  • 做仿站如何获取网站源码鞍山网站建设优化
  • 网站建设模拟实验报告wordpress表excel插件
  • 苏州企业网站建设电话包头网站制作公司
  • 邓州微网站建设上海十大广告公司排名
  • 深圳装修公司报价网络优化公司排名
  • 互联网建设网站的的好处中国建盏大师排名2021
  • 商城网站建设新闻制作一个网站需要多久