zoukankan      html  css  js  c++  java
  • SendMail如何签名

    MailAddress类有两个参数

    第1个参数:发送者的邮箱

    第2个参数:发送者的签名

    示例:

    MailMessage message = new MailMessage();
    message.From = new MailAddress(sender, signature);
    message.To.Add(recipient);

    完整代码:(参照动软代码生成的MailSend.cs)

    public static void Send(string server, string sender, string signature, string recipient, string subject,     string body, bool isBodyHtml, Encoding encoding, bool isAuthentication, params string[] files)        

    {            

    SmtpClient smtpClient = new SmtpClient(server);            

    //MailMessage message = new MailMessage(sender, recipient);

               

    MailMessage message = new MailMessage();            

    message.From = new MailAddress(sender, signature);            

    message.To.Add(recipient);           

    message.IsBodyHtml = isBodyHtml;           

    message.SubjectEncoding = encoding;            

    message.BodyEncoding = encoding;           

    message.Subject = subject;            

    message.Body = body;           

    message.Attachments.Clear();            

    if (files != null && files.Length != 0)            

    {                

    for (int i = 0; i < files.Length; ++i)  

     {                    

      Attachment attach = new Attachment(files[i]);                    

    message.Attachments.Add(attach);                

    }            

    }           

    if (isAuthentication == true)            

    {                

      smtpClient.Credentials = new NetworkCredential(SmtpConfig.Create().SmtpSetting.User, SmtpConfig.Create().SmtpSetting.Password);  

    }            

    smtpClient.Send(message);

    }

  • 相关阅读:
    All about Python
    All about TestComplete
    All about Ranorex
    围观大神们的博客
    CRP实施方法论(转)
    启发式测试策略模型(Heuristic Test Strategy Model,简称HTSM)(转)
    soapUI学习笔记---断言的小使用(转)
    soapUI学习笔记--用例字段参数化(转)
    常用功能测试点汇总(转)
    记一次性能测试实践1
  • 原文地址:https://www.cnblogs.com/huaci/p/3823680.html
Copyright © 2011-2022 走看看