1. <i id='hq8KR'><tr id='hq8KR'><dt id='hq8KR'><q id='hq8KR'><span id='hq8KR'><b id='hq8KR'><form id='hq8KR'><ins id='hq8KR'></ins><ul id='hq8KR'></ul><sub id='hq8KR'></sub></form><legend id='hq8KR'></legend><bdo id='hq8KR'><pre id='hq8KR'><center id='hq8KR'></center></pre></bdo></b><th id='hq8KR'></th></span></q></dt></tr></i><div id='hq8KR'><tfoot id='hq8KR'></tfoot><dl id='hq8KR'><fieldset id='hq8KR'></fieldset></dl></div>
    <tfoot id='hq8KR'></tfoot>

    1. <legend id='hq8KR'><style id='hq8KR'><dir id='hq8KR'><q id='hq8KR'></q></dir></style></legend>

    2. <small id='hq8KR'></small><noframes id='hq8KR'>

        <bdo id='hq8KR'></bdo><ul id='hq8KR'></ul>
    3. 在 C# 中为邮件编译 HTML 正文

      时间:2023-10-05

      <legend id='5bTdG'><style id='5bTdG'><dir id='5bTdG'><q id='5bTdG'></q></dir></style></legend>
        <i id='5bTdG'><tr id='5bTdG'><dt id='5bTdG'><q id='5bTdG'><span id='5bTdG'><b id='5bTdG'><form id='5bTdG'><ins id='5bTdG'></ins><ul id='5bTdG'></ul><sub id='5bTdG'></sub></form><legend id='5bTdG'></legend><bdo id='5bTdG'><pre id='5bTdG'><center id='5bTdG'></center></pre></bdo></b><th id='5bTdG'></th></span></q></dt></tr></i><div id='5bTdG'><tfoot id='5bTdG'></tfoot><dl id='5bTdG'><fieldset id='5bTdG'></fieldset></dl></div>
          <tfoot id='5bTdG'></tfoot>
        1. <small id='5bTdG'></small><noframes id='5bTdG'>

            • <bdo id='5bTdG'></bdo><ul id='5bTdG'></ul>

                <tbody id='5bTdG'></tbody>

                本文介绍了在 C# 中为邮件编译 HTML 正文的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我正在使用以下代码让用户向我的电子邮件发送报价.

                I am using the following codes for users to send me a quote to my email.

                    using System.Net.Mail;
                
                    MailMessage mail = new MailMessage();
                    mail.From = new MailAddress(Email.Text);
                    mail.To.Add("my yahoo email");
                    mail.Subject = "Requested Quote From my site";
                    mail.Body = "<br /><b>Primary project type:</b> " + ProjectTypeRadio.SelectedItem.Text + "<br /><b>Interested In:</b> " + InterestedCheck + "<br /><br /><br /><br /><b>PRODUCT DETAILS:</b><hr />" + Electric + HotWater + PoolHeating + SpaceHeating + "<br /> + "<br /><b>Message:</b><br /><hr /><br />" + txtMsg.Text + "<br /><br />";
                
                    SmtpClient smtp = new SmtpClient("smtp.mail.yahoo.com");
                    smtp.Send(mail);
                    Response.Redirect("Thanks.aspx");
                

                Web.Config

                <system.net>
                <mailSettings>
                  <smtp>
                    <network host="smtp.mail.yahoo.com" port="995" userName="my yahoo email" password="Password" />
                  </smtp>
                </mailSettings>
                

                问题:我正在我的雅虎帐户中接收邮件,但邮件未格式化,而是显示所有 HTML 标签,即

                PROBLEM: I am recieving the mail in my yahoo account but the message is not formated instead its showing all the HTML tags i.e.

                谁能检查我的代码并指出我的错误或指导我一个解决方案,这将是一个很大的帮助,谢谢.

                Can anyone please check my code and point my mistake or guide me a solution, it will be a big favor, thanks.

                推荐答案

                可以设置mail.IsBodyHTML = true

                此外,根据您发送的内容,您可能希望使用 AlternateViews 发送纯文本和 text/html 变体.

                Also, depending on what you're sending you may want to use AlternateViews to send both plain text and text/html variations.

                这篇关于在 C# 中为邮件编译 HTML 正文的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:System.Net.Mail 和 MailMessage 不立即发送消息 下一篇:C# - SMTP - GoDaddy - 发送电子邮件

                相关文章

                • <bdo id='54O1v'></bdo><ul id='54O1v'></ul>

                <legend id='54O1v'><style id='54O1v'><dir id='54O1v'><q id='54O1v'></q></dir></style></legend>
                  1. <tfoot id='54O1v'></tfoot>

                  2. <i id='54O1v'><tr id='54O1v'><dt id='54O1v'><q id='54O1v'><span id='54O1v'><b id='54O1v'><form id='54O1v'><ins id='54O1v'></ins><ul id='54O1v'></ul><sub id='54O1v'></sub></form><legend id='54O1v'></legend><bdo id='54O1v'><pre id='54O1v'><center id='54O1v'></center></pre></bdo></b><th id='54O1v'></th></span></q></dt></tr></i><div id='54O1v'><tfoot id='54O1v'></tfoot><dl id='54O1v'><fieldset id='54O1v'></fieldset></dl></div>

                  3. <small id='54O1v'></small><noframes id='54O1v'>