邮件输出是gmail收件箱中的RAW HTML [英] Output of mail is RAW HTML in gmail inbox

查看:156
本文介绍了邮件输出是gmail收件箱中的RAW HTML的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

I am creating email client application in windows forms. For sending mail, 
i am using Yarte control. When i am sending email, I am able to send the email but in my gmail inbox i am getting Output of mail is RAW HTML.

For example- i am getting output like this.
<pre>
!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<META content="text/html; charset=unicode" http-equiv=Content-Type>
<META name=GENERATOR content="MSHTML 8.00.7601.17514"></HEAD>
<BODY>
<DIV dir=ltr>
<DIV>Hello <BR></DIV>









在上面的HTML中,我的输出只是你好,但它增加了一些额外的原始html。



请帮忙。



我尝试了什么:







In above HTML, my output is only "Hello" but its adding some extra raw html.

Please help.

What I have tried:

i am using Yarte control. When i am sending email, I am able to send the email but in my gmail inbox i am getting Output of mail is RAW HTML.

                MailMessage mail = new MailMessage();
               SmtpClient SmtpServer = new SmtpClient("smtp.gmail.com");

                mail.From = new MailAddress(mailFrom);
                string mailAddresses = richtxtTo.Text;
                if(string.IsNullOrEmpty(mailAddresses))
                {
                    MessageBox.Show("Please specify atleast one recipient!");
                    return;
                }
                // This loop is used to send to multiple receiptents
                foreach (var address in mailAddresses.Split(new[] { ";" },       tringSplitOptions.RemoveEmptyEntries))
                {
                    mail.To.Add(mailAddresses);
                }
                //mail.To.Add(richtxtTo.Text);
                mail.Subject = mailSubject;
                mail.Body = htmlEditor1.Html;
                SmtpServer.Port = 587;
                SmtpServer.Credentials = new System.Net.NetworkCredential(mailTo, "Password");
                SmtpServer.EnableSsl = true;
                SmtpServer.Send(mail);
                MessageBox.Show("Mail Sent");
                htmlEditor1.Html = "";
                richtxtTo.Text = "";
                btnForward.Visible = true;
                btnReply.Visible = true;

推荐答案





在发送电子邮件之前添加 mail.IsBodyHtml = true;


这篇关于邮件输出是gmail收件箱中的RAW HTML的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆