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

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

        <small id='AQXX2'></small><noframes id='AQXX2'>

          <bdo id='AQXX2'></bdo><ul id='AQXX2'></ul>
        <tfoot id='AQXX2'></tfoot>

        PHP 邮件编码主题行

        时间:2023-10-03
        <legend id='qOpPd'><style id='qOpPd'><dir id='qOpPd'><q id='qOpPd'></q></dir></style></legend>

        <tfoot id='qOpPd'></tfoot>

          • <bdo id='qOpPd'></bdo><ul id='qOpPd'></ul>

            • <small id='qOpPd'></small><noframes id='qOpPd'>

                  <tbody id='qOpPd'></tbody>
                1. <i id='qOpPd'><tr id='qOpPd'><dt id='qOpPd'><q id='qOpPd'><span id='qOpPd'><b id='qOpPd'><form id='qOpPd'><ins id='qOpPd'></ins><ul id='qOpPd'></ul><sub id='qOpPd'></sub></form><legend id='qOpPd'></legend><bdo id='qOpPd'><pre id='qOpPd'><center id='qOpPd'></center></pre></bdo></b><th id='qOpPd'></th></span></q></dt></tr></i><div id='qOpPd'><tfoot id='qOpPd'></tfoot><dl id='qOpPd'><fieldset id='qOpPd'></fieldset></dl></div>
                  本文介绍了PHP 邮件编码主题行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  当我尝试从 PHP 发送 HTML 编码的电子邮件时,如果主题行包含特殊字符,例如 "这是您请求的信息",PHP 会将其编码为读取 "Here'是您请求的信息."

                  When I try to send a HTML encoded email from PHP, if the subject line contains special chars like "Here's the information you requested", PHP encodes it to read "Here&#039;s the information you requested."

                  我该如何解决这个问题?

                  How do I fix this?

                  以下是使用 PHP mail() 的代码:

                  Here's what the code looks like using PHP mail():

                  $headers  = 'MIME-Version: 1.0' . "
                  ";
                  $headers .= 'Content-type: text/html; charset=iso-8859-1' . "
                  ";
                  
                  $headers .= 'To: ' . $mod_params['name'] . '<' . $mod_params['email'] . '>' . "
                  ";
                  
                  $headers .= 'From: <do_not_reply@a4isp.com>' . "
                  ";  
                  
                  $email_to = $mod_params['email'];
                  
                  $email_sub = "Here's the Information You Requested";
                  
                  $body = html_entity_decode("<html><body>" . $email_html_body . "</body></html>");
                  
                  mail($email_to,$email_sub,$body,$headers);
                  

                  它给出与通过 SugarPHPMailer 类运行它相同的错误.

                  It gives the same error as running it through the SugarPHPMailer class.

                  推荐答案

                  试试这个:

                   $newsubject='=?UTF-8?B?'.base64_encode($subject).'?=';
                  

                  这样您就不必依赖 PHP 或 MTA 的编码,您就可以完成工作,并且邮件客户端应该理解它.您的新主题中不会出现特殊字符,因此在发送电子邮件时不会出现任何问题.

                  This way you don't rely on PHP or the MTA's encoding, you do the job, and the mail client should understand it. No special characters will be present in your new subject, so no problems should arise while delivering the email.

                  这篇关于PHP 邮件编码主题行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:将 SQL_Latin1_General_CP1_CI_AS 编码为 UTF-8 下一篇:未在 html 文档中声明的字符编码

                  相关文章

                  最新文章

                  <small id='oJ0PC'></small><noframes id='oJ0PC'>

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

                    <bdo id='oJ0PC'></bdo><ul id='oJ0PC'></ul>
                  1. <legend id='oJ0PC'><style id='oJ0PC'><dir id='oJ0PC'><q id='oJ0PC'></q></dir></style></legend>

                  2. <tfoot id='oJ0PC'></tfoot>