在发送PEAR Mail_Mime电子邮件时,邮件html中的这里和那里都丢失了php-dot(.)

我使用PEAR的邮件和mail_mime包和示例代码发送邮件,如下所示:
$sendStart=array();
require_once('Mail.php');
require_once('Mail/mime.php');

$sendStart['mail'] =& Mail::factory('mail');
$sendStart['mime'] = new Mail_mime("\n");

$sendStart['mime']->setHTMLBody($html);
$sendStart['headers']['Subject']=$title;
$sendStart['headers']['X-SMTPAPI']='{"category": ["MailID-XXX"]}';

$body=$sendStart['mime']->get(array(
        'html_charset'=>'UTF-8','text_charset'=>'UTF-8','head_charset'=>'UTF-8'
    ));

//echo ($sendStart['mime']->_htmlbody); exit;
$sendStart['mail']->send('xxx@example.com',$sendStart['mime']->headers($sendStart['headers']),$body);

通过这段代码发送邮件时,我面临着一个奇怪的问题.电子邮件正文中有图像,有时图像不显示.当我调试问题时,我发现.在图像网址中缺少.但是如果我在发送行之前打印邮件(正如我在代码中注释的那样),它将完美地打印图像.

正确的图片网址:http://www.domain.com/image.png

在邮件:http://www.domaincom/image.png或http://www.domain.com/imagepng …等

具有以下图像的HTML代码的一部分:

<table cellpadding="0" cellspacing="0" border="0" class="image-table image-2" align="center" style="float:none;margin-left:auto;margin-right:auto;text-align:left;">
    <tbody>
      <tr>
        <td class="element" style="text-align: left;height: auto;overflow: hidden;-webkit-text-size-adjust: none;">
          <!--[if gte mso 9]><img alt="Placeholder Image" src="http://www.domain.com/image.png" style="outline: none; text-decoration: none; display: block; clear: none; float: none;    margin-left: auto; margin-right: auto;display:none; mso-hide: none;" align="center" width="394"><![endif]--><![if !mso]><!-- --><img alt="Placeholder Image" src="http://www.domain.com/image.png" style="outline: none;text-decoration: none;display: block;clear: none;float: none;width: 100%;height: auto;max-width: 394px;margin-left: auto;margin-right: auto;*width: 394px;-ms-interpolation-mode: bicubic;" align="center"><!--<![endif]-->
        </td>
      </tr>
    </tbody>
</table>

而且非常奇怪的是它在Outlook中正常显示,但在其他客户端中显示不正确,因为outlook我有单独的代码(根据代码).

有人有任何想法如何调试问题或任何关于这个问题的评论.

编辑:

这个问题与任何特定的标签无关(虽然我使用图像标签来解释),我在几个地方体验到,如风格.

例如:line-heigth:1.5;是原来的,它变化为线 – 高:15;同时发送.

基本上它只是删除.这里&那里有电子邮件HTML.

解决方法

我很确定这是由点填充造成的;因为该点被用作电子邮件中的特殊指示符.您可以在 the rfc中阅读有关这一点的内容(重点在于):

To allow all user composed text to be transmitted transparently,the following procedures are used:

  • Before sending a line of mail text,the SMTP client checks the first character of the line. If it is a period,one additional period is inserted at the beginning of the line.
  • When a line of mail text is received by the SMTP server,it checks the line. If the line is composed of a single period,it is treated as the end of mail indicator. If the first character is a period and there are other characters on the line,the first character is deleted.

您用来撰写这些电子邮件的客户端似乎没有实现第一个过程,而发送邮件的服务器却实现了它;导致点消失.

修复将是让您的客户端实现填充.

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


html5中section的用法
span标签和p标签的区别
jsp文件和html文件的区别是什么
span标签和div的区别
html颜色代码表大全
span标签的作用是什么
dhtml的主要组成部分包括什么
html编辑器哪个软件好用
span标签属于什么样式标签
html文件乱码怎么办
html怎么读取json文件
html文件打开乱码怎么恢复原状
html怎么链接外部css
html文件怎么保存到本地
html怎么链接css文件
html和css怎么连接
html和css怎么关联
html文件怎么保存到一个站点
html文件怎么写
html出现乱码怎么解决