sendSmtp.cs
上传用户:hncsjykj
上传日期:2022-08-09
资源大小:461k
文件大小:23k
源码类别:

Email客户端

开发平台:

C#

  1. using System;
  2. using System.Text;
  3. using System.IO;
  4. using System.Net;
  5. using System.Net.Sockets;
  6. using System.Collections;
  7. namespace LYBemail
  8. {
  9.    
  10.     public class sendSmtp
  11.     {       
  12.         private string enter = "rn";
  13.         ///   <summary>     
  14.         ///   设定语言代码,默认设定为GB2312,如不需要可设置为""     
  15.         ///   </summary>     
  16.         public string Charset = "GB2312";
  17.         ///   <summary>     
  18.         ///   发件人地址     
  19.         ///   </summary>     
  20.         public string From = "";
  21.         ///   <summary>     
  22.         ///   发件人姓名     
  23.         ///   </summary>     
  24.         public string FromName = "";
  25.         ///   <summary>     
  26.         ///   回复邮件地址     
  27.         ///   </summary>     
  28.         //public   string   ReplyTo="";     
  29.         ///   <summary>     
  30.         ///   收件人姓名     
  31.         ///   </summary>           
  32.         public string RecipientName = "";
  33.         ///   <summary>     
  34.         ///   收件人列表     
  35.         ///   </summary>     
  36.         private Hashtable Recipient = new Hashtable();
  37.         ///   <summary>     
  38.         ///   邮件服务器域名     
  39.         ///   </summary>           
  40.         private string mailserver = "";
  41.         ///   <summary>     
  42.         ///   邮件服务器端口号     
  43.         ///   </summary>           
  44.         private int mailserverport = 25;
  45.         ///   <summary>     
  46.         ///   SMTP认证时使用的用户名     
  47.         ///   </summary>     
  48.         public  string username = "";
  49.         ///   <summary>     
  50.         ///   SMTP认证时使用的密码     
  51.         ///   </summary>     
  52.         public  string password = "";
  53.         ///   <summary>     
  54.         ///   是否需要SMTP验证     
  55.         ///   </summary>                 
  56.         private bool ESmtp = true;
  57.         ///   <summary>     
  58.         ///   是否Html邮件     
  59.         ///   </summary>                 
  60.         public bool Html = false;
  61.         ///   <summary>     
  62.         ///   邮件附件列表     
  63.         ///   </summary>     
  64.         private System.Collections.ArrayList Attachments;
  65.         ///   <summary>     
  66.         ///   邮件发送优先级,可设置为"High","Normal","Low"或"1","3","5"     
  67.         ///   </summary>     
  68.         private string priority = "Normal";
  69.         ///   <summary>     
  70.         ///   邮件主题     
  71.         ///   </summary>                 
  72.         public string Subject = "";
  73.         ///   <summary>     
  74.         ///   邮件正文     
  75.         ///   </summary>                 
  76.         public string Body = "";
  77.         ///   <summary>     
  78.         ///   收件人数量     
  79.         ///   </summary>     
  80.         private int RecipientNum = 0;
  81.         ///   <summary>     
  82.         ///   最多收件人数量     
  83.         ///   </summary>     
  84.         private int recipientmaxnum = 1;
  85.         ///   <summary>     
  86.         ///   密件收件人数量     
  87.         ///   </summary>     
  88.         //private   int   RecipientBCCNum=0;     
  89.         ///   <summary>     
  90.         ///   错误消息反馈     
  91.         ///   </summary>     
  92.         private string errmsg;
  93.         ///   <summary>     
  94.         ///   TcpClient对象,用于连接服务器     
  95.         ///   </summary>           
  96.         private TcpClient tc;
  97.         ///   <summary>     
  98.         ///   NetworkStream对象     
  99.         ///   </summary>           
  100.         private NetworkStream ns;
  101.         ///   <summary>     
  102.         ///   SMTP错误代码哈希表     
  103.         ///   </summary>     
  104.         private Hashtable ErrCodeHT = new Hashtable();
  105.         ///   <summary>     
  106.         ///   SMTP正确代码哈希表     
  107.         ///   </summary>     
  108.         private Hashtable RightCodeHT = new Hashtable();
  109.         public sendSmtp()
  110.         {
  111.             Attachments = new System.Collections.ArrayList();
  112.         }
  113.         ///   <summary>     
  114.         ///   邮件服务器域名和验证信息     
  115.         ///   形如:"user:pass@www.server.com:25",也可省略次要信息。如"user:pass@www.server.com"或"www.server.com"     
  116.         ///   </summary>           
  117.         public string MailDomain
  118.         {
  119.             set
  120.             {
  121.                 string maidomain = value.Trim();
  122.                 int tempint;
  123.                 if (maidomain != "")
  124.                 {
  125.                     tempint = maidomain.IndexOf("@");
  126.                     if (tempint != -1)
  127.                     {
  128.                         string str = maidomain.Substring(0, tempint);
  129.                         MailServerUserName = str.Substring(0, str.IndexOf(":"));
  130.                         MailServerPassWord = str.Substring(str.IndexOf(":") + 1, str.Length - str.IndexOf(":") - 1);
  131.                         maidomain = maidomain.Substring(tempint + 1, maidomain.Length - tempint - 1);
  132.                     }
  133.                     tempint = maidomain.IndexOf(":");
  134.                     if (tempint != -1)
  135.                     {
  136.                         mailserver = maidomain.Substring(0, tempint);
  137.                         mailserverport = System.Convert.ToInt32(maidomain.Substring(tempint + 1, maidomain.Length - tempint - 1));
  138.                     }
  139.                     else
  140.                     {
  141.                         mailserver = maidomain;
  142.                     }
  143.                 }
  144.             }
  145.         }
  146.         ///   <summary>     
  147.         ///   邮件服务器端口号     
  148.         ///   </summary>           
  149.         public int MailDomainPort
  150.         {
  151.             set
  152.             {
  153.                 mailserverport = value;
  154.             }
  155.         }
  156.         ///   <summary>     
  157.         ///   SMTP认证时使用的用户名     
  158.         ///   </summary>     
  159.         public string MailServerUserName
  160.         {
  161.             set
  162.             {
  163.                 if (value.Trim() != "")
  164.                 {
  165.                     username = value.Trim();
  166.                     ESmtp = true;
  167.                 }
  168.                 else
  169.                 {
  170.                     username = "";
  171.                     ESmtp = false;
  172.                 }
  173.             }
  174.         }
  175.         ///   <summary>     
  176.         ///   SMTP认证时使用的密码     
  177.         ///   </summary>     
  178.         public string MailServerPassWord
  179.         {
  180.             set
  181.             {
  182.                 password = value;
  183.             }
  184.         }
  185.         ///   <summary>     
  186.         ///   邮件发送优先级,可设置为"High","Normal","Low"或"1","3","5"     
  187.         ///   </summary>     
  188.         public string Priority
  189.         {
  190.             set
  191.             {
  192.                 switch (value.ToLower())
  193.                 {
  194.                     case "high":
  195.                         priority = "High";
  196.                         break;
  197.                     case "1":
  198.                         priority = "High";
  199.                         break;
  200.                     case "normal":
  201.                         priority = "Normal";
  202.                         break;
  203.                     case "3":
  204.                         priority = "Normal";
  205.                         break;
  206.                     case "low":
  207.                         priority = "Low";
  208.                         break;
  209.                     case "5":
  210.                         priority = "Low";
  211.                         break;
  212.                     default:
  213.                         priority = "Normal";
  214.                         break;
  215.                 }
  216.             }
  217.         }
  218.         ///   <summary>     
  219.         ///   错误消息反馈     
  220.         ///   </summary>                 
  221.         public string ErrorMessage
  222.         {
  223.             get
  224.             {
  225.                 return errmsg;
  226.             }
  227.         }
  228.         ///   <summary>     
  229.         ///   服务器交互记录     
  230.         ///   </summary>     
  231.         private string logs = "";
  232.         ///   <summary>     
  233.         ///   服务器交互记录,如发现本组件不能使用的SMTP服务器,请将出错时的Logs发给我(lion-a@sohu.com),我将尽快查明原因。     
  234.         ///   </summary>     
  235.         public string Logs
  236.         {
  237.             get
  238.             {
  239.                 return logs;
  240.             }
  241.         }
  242.         ///   <summary>     
  243.         ///   SMTP回应代码哈希表     
  244.         ///   </summary>     
  245.         private void SMTPCodeAdd()
  246.         {
  247.             ErrCodeHT.Add("500", "邮箱地址错误");
  248.             ErrCodeHT.Add("501", "参数格式错误");
  249.             ErrCodeHT.Add("502", "命令不可实现");
  250.             ErrCodeHT.Add("503", "服务器需要SMTP验证");
  251.             ErrCodeHT.Add("504", "命令参数不可实现");
  252.             ErrCodeHT.Add("421", "服务未就绪,关闭传输信道");
  253.             ErrCodeHT.Add("450", "要求的邮件操作未完成,邮箱不可用(例如,邮箱忙)");
  254.             ErrCodeHT.Add("550", "要求的邮件操作未完成,邮箱不可用(例如,邮箱未找到,或不可访问)");
  255.             ErrCodeHT.Add("451", "放弃要求的操作;处理过程中出错");
  256.             ErrCodeHT.Add("551", "用户非本地,请尝试<forward-path>");
  257.             ErrCodeHT.Add("452", "系统存储不足,要求的操作未执行");
  258.             ErrCodeHT.Add("552", "过量的存储分配,要求的操作未执行");
  259.             ErrCodeHT.Add("553", "邮箱名不可用,要求的操作未执行(例如邮箱格式错误)");
  260.             ErrCodeHT.Add("432", "需要一个密码转换");
  261.             ErrCodeHT.Add("534", "认证机制过于简单");
  262.             ErrCodeHT.Add("538", "当前请求的认证机制需要加密");
  263.             ErrCodeHT.Add("454", "临时认证失败");
  264.             ErrCodeHT.Add("530", "需要认证");
  265.             RightCodeHT.Add("220", "服务就绪");
  266.             RightCodeHT.Add("250", "要求的邮件操作完成");
  267.             RightCodeHT.Add("251", "用户非本地,将转发向<forward-path>");
  268.             RightCodeHT.Add("354", "开始邮件输入,以<enter>.<enter>结束");
  269.             RightCodeHT.Add("221", "服务关闭传输信道");
  270.             RightCodeHT.Add("334", "服务器响应验证Base64字符串");
  271.             RightCodeHT.Add("235", "验证成功");
  272.         }
  273.         ///   <summary>     
  274.         ///   将字符串编码为Base64字符串     
  275.         ///   </summary>     
  276.         ///   <param   name="estr">要编码的字符串</param>     
  277.         private string Base64Encode(string str)
  278.         {
  279.             byte[] barray;
  280.             barray = Encoding.Default.GetBytes(str);
  281.             return Convert.ToBase64String(barray);
  282.         }
  283.         ///   <summary>     
  284.         ///   将Base64字符串解码为普通字符串     
  285.         ///   </summary>     
  286.         ///   <param   name="dstr">要解码的字符串</param>     
  287.         private string Base64Decode(string str)
  288.         {
  289.             byte[] barray;
  290.             barray = Convert.FromBase64String(str);
  291.             return Encoding.Default.GetString(barray);
  292.         }
  293.         ///   <summary>     
  294.         ///   得到上传附件的文件流     
  295.         ///   </summary>     
  296.         ///   <param   name="FilePath">附件的绝对路径</param>     
  297.         private string GetStream(string FilePath)
  298.         {
  299.             //建立文件流对象     
  300.             System.IO.FileStream FileStr = new System.IO.FileStream(FilePath, System.IO.FileMode.Open);
  301.             byte[] by = new byte[System.Convert.ToInt32(FileStr.Length)];
  302.             FileStr.Read(by, 0, by.Length);
  303.             FileStr.Close();
  304.             return (System.Convert.ToBase64String(by));
  305.         }
  306.         ///   <summary>     
  307.         ///   添加邮件附件     
  308.         ///   </summary>     
  309.         ///   <param   name="path">附件绝对路径</param>     
  310.         public void AddAttachment(string path)
  311.         {
  312.             Attachments.Add(path);
  313.         }
  314.         ///   <summary>     
  315.         ///   添加一个收件人     
  316.         ///   </summary>           
  317.         ///   <param   name="str">收件人地址</param>     
  318.         public bool AddRecipient(string str)
  319.         {
  320.             str = str.Trim();
  321.             if (str == null || str == "" || str.IndexOf("@") == -1)
  322.                 return true;
  323.             if (RecipientNum < recipientmaxnum)
  324.             {
  325.                 Recipient.Add(RecipientNum, str);
  326.                 RecipientNum++;
  327.                 return true;
  328.             }
  329.             else
  330.             {
  331.                 errmsg += "收件人过多";
  332.                 return false;
  333.             }
  334.         }
  335.         ///   <summary>     
  336.         ///   最多收件人数量     
  337.         ///   </summary>     
  338.         public int RecipientMaxNum
  339.         {
  340.             set
  341.             {
  342.                 recipientmaxnum = value;
  343.             }
  344.         }
  345.         ///   <summary>     
  346.         ///   添加一组收件人(不超过recipientmaxnum个),参数为字符串数组     
  347.         ///   </summary>     
  348.         ///   <param   name="str">保存有收件人地址的字符串数组(不超过recipientmaxnum个)</param>           
  349.         public bool AddRecipient(string[] str)
  350.         {
  351.             for (int i = 0; i < str.Length; i++)
  352.             {
  353.                 if (!AddRecipient(str[i]))
  354.                 {
  355.                     return false;
  356.                 }
  357.             }
  358.             return true;
  359.         }
  360.         ///   <summary>     
  361.         ///   发送SMTP命令     
  362.         ///   </summary>           
  363.         private bool SendCommand(string str)
  364.         {
  365.             byte[] WriteBuffer;
  366.             if (str == null || str.Trim() == "")
  367.             {
  368.                 return true;
  369.             }
  370.             logs += str;
  371.             WriteBuffer = Encoding.Default.GetBytes(str);
  372.             try
  373.             {
  374.                 ns.Write(WriteBuffer, 0, WriteBuffer.Length);
  375.             }
  376.             catch
  377.             {
  378.                 errmsg = "网络连接错误";
  379.                 return false;
  380.             }
  381.             return true;
  382.         }
  383.         ///   <summary>     
  384.         ///   接收SMTP服务器回应     
  385.         ///   </summary>     
  386.         private string RecvResponse()
  387.         {
  388.             int StreamSize;
  389.             string ReturnValue = "";
  390.             byte[] ReadBuffer = new byte[1024];
  391.             try
  392.             {
  393.                 StreamSize = ns.Read(ReadBuffer, 0, ReadBuffer.Length);
  394.             }
  395.             catch
  396.             {
  397.                 errmsg = "网络连接错误";
  398.                 return "false";
  399.             }
  400.             if (StreamSize == 0)
  401.             {
  402.                 return ReturnValue;
  403.             }
  404.             else
  405.             {
  406.                 ReturnValue = Encoding.Default.GetString(ReadBuffer).Substring(0, StreamSize);
  407.                 logs += ReturnValue;
  408.                 return ReturnValue;
  409.             }
  410.         }
  411.         ///   <summary>     
  412.         ///   与服务器交互,发送一条命令并接收回应。     
  413.         ///   </summary>     
  414.         ///   <param   name="Command">一个要发送的命令</param>     
  415.         ///   <param   name="errstr">如果错误,要反馈的信息</param>     
  416.         private bool Dialog(string str, string errstr)
  417.         {
  418.             if (str == null || str.Trim() == "")
  419.             {
  420.                 return true;
  421.             }
  422.             if (SendCommand(str))
  423.             {
  424.                 string RR = RecvResponse();
  425.                 if (RR == "false")
  426.                 {
  427.                     return false;
  428.                 }
  429.                 string RRCode = RR.Substring(0, 3);
  430.                 if (RightCodeHT[RRCode] != null)
  431.                 {
  432.                     return true;
  433.                 }
  434.                 else
  435.                 {
  436.                     if (ErrCodeHT[RRCode] != null)
  437.                     {
  438.                         errmsg += (RRCode + ErrCodeHT[RRCode].ToString());
  439.                         errmsg += enter;
  440.                     }
  441.                     else
  442.                     {
  443.                         errmsg += RR;
  444.                     }
  445.                     errmsg += errstr;
  446.                     return false;
  447.                 }
  448.             }
  449.             else
  450.             {
  451.                 return false;
  452.             }
  453.         }
  454.         ///   <summary>     
  455.         ///   与服务器交互,发送一组命令并接收回应。     
  456.         ///   </summary>     
  457.         private bool Dialog(string[] str, string errstr)
  458.         {
  459.             for (int i = 0; i < str.Length; i++)
  460.             {
  461.                 if (!Dialog(str[i], ""))
  462.                 {
  463.                     errmsg += enter;
  464.                     errmsg += errstr;
  465.                     return false;
  466.                 }
  467.             }
  468.             return true;
  469.         }
  470.         private bool SendEmail()
  471.         {
  472.             //连接网络     
  473.             try
  474.             {
  475.                 tc = new TcpClient(mailserver, mailserverport);
  476.             }
  477.             catch (Exception e)
  478.             {
  479.                 errmsg = e.ToString();
  480.                 return false;
  481.             }
  482.             ns = tc.GetStream();
  483.             SMTPCodeAdd();
  484.             //验证网络连接是否正确     
  485.             if (RightCodeHT[RecvResponse().Substring(0, 3)] == null)
  486.             {
  487.                 errmsg = "网络连接失败";
  488.                 return false;
  489.             }
  490.             string[] SendBuffer;
  491.             string SendBufferstr;
  492.             //进行SMTP验证     
  493.             if (ESmtp)
  494.             {
  495.                 SendBuffer = new String[4];
  496.                 SendBuffer[0] = "EHLO   " + mailserver + enter;
  497.                 SendBuffer[1] = "AUTH   LOGIN" + enter;
  498.                 SendBuffer[2] = Base64Encode(username) + enter;
  499.                 SendBuffer[3] = Base64Encode(password) + enter;
  500.                
  501.                 if (!Dialog(SendBuffer, "SMTP服务器验证失败,请核对用户名和密码。"))
  502.                     return false;
  503.             }
  504.             else
  505.             {
  506.                 SendBufferstr = "HELO   " + mailserver + enter;
  507.                 if (!Dialog(SendBufferstr, ""))
  508.                     return false;
  509.             }
  510.             //     
  511.             SendBufferstr = "MAIL   FROM:<" + From + ">" + enter;
  512.             if (!Dialog(SendBufferstr, "发件人地址错误,或不能为空"))
  513.                 return false;
  514.             //     
  515.             SendBuffer = new string[recipientmaxnum];
  516.             for (int i = 0; i < Recipient.Count; i++)
  517.             {
  518.                 SendBuffer[i] = "RCPT   TO:<" + Recipient[i].ToString() + ">" + enter;
  519.             }
  520.             if (!Dialog(SendBuffer, "收件人地址有误"))
  521.                 return false;
  522.             SendBufferstr = "DATA" + enter;
  523.             if (!Dialog(SendBufferstr, ""))
  524.                 return false;
  525.             SendBufferstr = "From:" + FromName + "<" + From + ">" + enter;
  526.             SendBufferstr += "To:=?" + Charset.ToUpper() + "?B?" + Base64Encode(RecipientName) + "?=" + "<" + Recipient[0] + ">" + enter;
  527.             SendBufferstr += "CC:";
  528.             for (int i = 0; i < Recipient.Count; i++)
  529.             {
  530.                 SendBufferstr += Recipient[i].ToString() + "<" + Recipient[i].ToString() + ">,";
  531.             }
  532.             SendBufferstr += enter;
  533.             if (Charset == "")
  534.             {
  535.                 SendBufferstr += "Subject:" + Subject + enter;
  536.             }
  537.             else
  538.             {
  539.                 SendBufferstr += "Subject:" + "=?" + Charset.ToUpper() + "?B?" + Base64Encode(Subject) + "?=" + enter;
  540.             }
  541.             SendBufferstr += "X-Priority:" + priority + enter;
  542.             SendBufferstr += "X-MSMail-Priority:" + priority + enter;
  543.             SendBufferstr += "Importance:" + priority + enter;
  544.             SendBufferstr += "X-Mailer:   Huolx.Pubclass" + enter;
  545.             SendBufferstr += "MIME-Version:   1.0" + enter;
  546.             SendBufferstr += "Content-Type:   multipart/mixed;" + enter;//内容格式和分隔符     
  547.             SendBufferstr += "       boundary="----=_NextPart_000_00D6_01C29593.AAB31770"" + enter;
  548.             SendBufferstr += "------=_NextPart_000_00D6_01C29593.AAB31770" + enter;
  549.             if (Html)
  550.             {
  551.                 SendBufferstr += "Content-Type:   text/html;" + enter;
  552.             }
  553.             else
  554.             {
  555.                 SendBufferstr += "Content-Type:   text/plain;" + enter;
  556.             }
  557.             if (Charset == "")
  558.             {
  559.                 SendBufferstr += "       charset="iso-8859-1"" + enter;
  560.             }
  561.             else
  562.             {
  563.                 SendBufferstr += "       charset="" + Charset.ToLower() + """ + enter;
  564.             }
  565.             //SendBufferstr   +=   "Content-Transfer-Encoding:   base64"+enter;     
  566.             SendBufferstr += "Content-Transfer-Encoding:   base64" + enter + enter;
  567.             SendBufferstr += Base64Encode(Body) + enter;
  568.             if (Attachments.Count != 0)
  569.             {
  570.                 foreach (string filepath in Attachments)
  571.                 {
  572.                     SendBufferstr += "------=_NextPart_000_00D6_01C29593.AAB31770" + enter;
  573.                     SendBufferstr += "Content-Type:   application/octet-stream" + enter;
  574.                     SendBufferstr += "       name="=?" + Charset.ToUpper() + "?B?" + Base64Encode(filepath.Substring(filepath.LastIndexOf("\") + 1)) + "?="" + enter;
  575.                     SendBufferstr += "Content-Transfer-Encoding:   base64" + enter;
  576.                     SendBufferstr += "Content-Disposition:   attachment;" + enter;
  577.                     SendBufferstr += "       filename="=?" + Charset.ToUpper() + "?B?" + Base64Encode(filepath.Substring(filepath.LastIndexOf("\") + 1)) + "?="" + enter + enter;
  578.                     SendBufferstr += GetStream(filepath) + enter + enter;
  579.                 }
  580.             }
  581.             SendBufferstr += "------=_NextPart_000_00D6_01C29593.AAB31770--" + enter + enter;
  582.             SendBufferstr += enter + "." + enter;
  583.             if (!Dialog(SendBufferstr, "错误信件信息"))
  584.                 return false;
  585.             SendBufferstr = "QUIT" + enter;
  586.             if (!Dialog(SendBufferstr, "断开连接时错误"))
  587.                 return false;
  588.             ns.Close();
  589.             tc.Close();
  590.             return true;
  591.         }
  592.         ///   <summary>     
  593.         ///   发送邮件方法,所有参数均通过属性设置。     
  594.         ///   </summary>     
  595.         public bool Send()
  596.         {
  597.             if (Recipient.Count == 0)
  598.             {
  599.                 errmsg = "收件人列表不能为空";
  600.                 return false;
  601.             }
  602.             if (mailserver.Trim() == "")
  603.             {
  604.                 errmsg = "必须指定SMTP服务器";
  605.                 return false;
  606.             }
  607.             return SendEmail();
  608.         }
  609.         ///   <summary>     
  610.         ///   发送邮件方法     
  611.         ///   </summary>     
  612.         ///   <param   name="smtpserver">smtp服务器信息,如"username:password@www.smtpserver.com:25",也可去掉部分次要信息,如"www.smtpserver.com"</param>     
  613.         public bool Send(string smtpserver)
  614.         {
  615.             MailDomain = smtpserver;
  616.             return Send();
  617.         }
  618.         ///   <summary>     
  619.         ///   发送邮件方法     
  620.         ///   </summary>     
  621.         ///   <param   name="smtpserver">smtp服务器信息,如"username:password@www.smtpserver.com:25",也可去掉部分次要信息,如"www.smtpserver.com"</param>     
  622.         ///   <param   name="from">发件人mail地址</param>     
  623.         ///   <param   name="fromname">发件人姓名</param>     
  624.         ///   <param   name="to">收件人地址</param>     
  625.         ///   <param   name="toname">收件人姓名</param>     
  626.         ///   <param   name="html">是否HTML邮件</param>     
  627.         ///   <param   name="subject">邮件主题</param>     
  628.         ///   <param   name="body">邮件正文</param>     
  629.         public bool Send(string smtpserver, string from, string fromname, string to, string toname, bool html, string subject, string body)
  630.         {
  631.             MailDomain = smtpserver;
  632.             From = from;
  633.             FromName = fromname;
  634.             AddRecipient(to);
  635.             RecipientName = toname;
  636.             Html = html;
  637.             Subject = subject;
  638.             Body = body;
  639.             return Send();
  640.         }
  641.     }
  642. }