zoukankan      html  css  js  c++  java
  • .net active up mail 邮件发送

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using ActiveUp.Net.Mail;

    namespace ConsoleApplication1
    {
        class Program
        {
            static void Main(string[] args)
            {
                Send();
            }
            public static void Send()
            {
                Message mail = new Message();
                mail.From = new Address("from");
                mail.Charset = "utf-8";
                mail.ContentTransferEncoding = ContentTransferEncoding.Base64;
                mail.Date = System.DateTime.UtcNow;
                List<string> toList = new List<string>();
                toList.Add("tomail");
                //接收地址
                foreach (var to in toList)
                {
                    mail.To.Add(to);
                }
              
                  //标题  同时设置编码为utf-8
                mail.Subject = Codec.RFC2047Encode("test使用様", Encoding.UTF8.BodyName);
                //邮件内容
                mail.BodyHtml.Charset = "utf-8";
            
              
               string body="As promised, the requested document.<br/>RegardsJohn";
                mail.BodyHtml.Text =body;
                                             
                try
                {
                    SmtpClient.SendSsl(mail, mailhost,userid, mailpass, SaslMechanism.Login);

                }
                catch (Exception)
                {

                    throw;
                }
            }
        }
    }

  • 相关阅读:
    误删本地分支,两天的工作量差点毁于一旦,使用git reflog 有惊无险恢复
    单点登录SSO
    IdentityServer4介绍和使用
    常见的远程无线通信技术
    4G模块和DTU模块有何区别
    以太网IO控制器
    什么是无线网关,无线网关的功能
    什么是IOT网关,网关功能有哪些
    Modbus RTU和Modbus TCP的两种区别
    数据采集网关设备 如何选择数据采集网关
  • 原文地址:https://www.cnblogs.com/c-x-a/p/5531926.html
Copyright © 2011-2022 走看看