通过Net.mail发送,
msg.IsBodyHtml = true
为什么用Outlook接收会显示乱码?要点HTML邮件才能正常显示?我想实现Outlook接收时,内容显示文本,带html附件怎么实现?谢谢!

解决方案 »

  1.   

    取消这句ContentType = "text/html"就不会乱码了.
    但是你要设定内容时用HTMLBODY属性了
      

  2.   

        public void email()
        {
            string body = """;
            MailAddress frommail = new MailAddress("[email protected]");
            MailAddress tomail = new MailAddress(txtEmail.Text.Trim());
            MailMessage objMailMessage = new MailMessage(frommail,tomail);
            objMailMessage.BodyEncoding = System.Text.Encoding.UTF8;
            objMailMessage.Subject ="成功注册欢迎信件";//发送邮件的标题 
            objMailMessage.IsBodyHtml = true;
            objMailMessage.Body = "" + body+ " ";//发送邮件的内容 
            SmtpClient client = new SmtpClient("smtp.ectrader.net");
            NetworkCredential smtpuserinfo = new NetworkCredential();
            smtpuserinfo.UserName = "[email protected]";
            smtpuserinfo.Password = "cyu1234";
            client.Credentials = smtpuserinfo;
            
            //开始发送邮件 
            try
            {
               // SmtpMail.Send(objMailMessage);]
                client.Send(objMailMessage);
            }
            catch(Exception ex)
            {
                PComm.Comm.Show(this.Page, "注册成功,但邮件发送出错,请手动打开主页");
            }
            //Response.Redirect("index.aspx");
            //outlook配置http://mail.126.com/help/client_04.htm 
        }
      

  3.   

    解决了!!
    msg.IsBodyHtml =true
    System.Text.Encoding.Defaultoutlook和foxmail都能正常显示.