日期:2014-05-17  浏览次数:20849 次

smtp邮件发送HTML表格
 /// <summary>
        /// 邮件的发送
        /// </summary>
        public void Send()
        {
            string toMailAddress = "7*****8@qq.com";
            string fromMailAddress = "********@qq.com";
            string subjectInfo = "Test sending e_mail";
            string bodyInfo = string.Format(@"<table id=table1 runat=server border=0   bgcolor=black cellspacing=1 style=color:White><tr style=text-align: center;><td colspan=4 style=font-size: large; border: 1px solid Gray; height:45px>客户资料表</td><td>'" + this.Text.Value + "'</td></tr></table>");
              
            try
            {
                if (mMailMessage != null)
                {
                    mSmtpClient = new SmtpClient();
                    //mSmtpClient.Host = "smtp." + mMailMessage.From.Host;
                    mSmtpClient.Host = this.mSenderServerHost;
                    mSmtpClient.Port = this.mSenderPort;
                    mSmtpClient.UseDefaultCredentials = false;
                    mSmtpClient.EnableSsl = this.mEnableSsl;
                    if (this.mEnablePwdAuthentication)
                    {
                        System.Net.NetworkCredential nc = new System.Net.NetworkCredential(this.mSenderUsername, this.mSenderPassword);
                        //mSmtpClient.Credentials = new System.Net.NetworkCredential(this.mSenderUsername, this.mSenderPassword);
                        //NTLM: Secure Password Authentication in Microsoft Outlook