【问题标题】:How to remove random spaces in html mail?如何删除html邮件中的随机空格?
【发布时间】:2015-05-29 00:26:26
【问题描述】:

我看到 html 邮件中的随机空格破坏了整个 html 结构并给出了奇怪的 html 邮件。

我正在使用 SENDY 通讯 API 向客户发送邮件。 html 邮件在所有其他电子邮件客户端(如 Outlook Express 等)中运行良好。除了“ZIMBRA”电子邮件客户端,我看到随机空格会导致奇怪的 html 邮件。

例如:如果图像路径是 http://www.example.com/12.jpg 并且它会给你

http://www.example.com/1 2.jpg

代码

$postdata = http_build_query(
                array(
                    'api_key' => 'xxx',
                    'from_name' => 'xxx',
                    'from_email' => 'xxx',
                    'reply_to' => 'xxx',
                    'subject' => 'Daily',
                    'html_text' => html_content,
                    'list_ids' => 'hhjh',   
                    'send_campaign' => 1
                )
            );   

$opts = array('http' => array('method'  => 'POST', 'header'  => Array('Content: text/html', 'charset=UTF-8'), 'content' => $postdata));

请帮助我,在此先感谢。

【问题讨论】:

标签: php html email zimbra sendy


【解决方案1】:

尝试使用 Trim 函数或尝试 str_replace(' ','','生成图像的变量')

【讨论】:

  • 随机空间插入是在 ZIMBRA 级别而不是 php 级别进行的。
【解决方案2】:

我终于能够找到解决方案。我添加了这样的编码属性 $mail-> 编码 = base64。它奏效了。

【讨论】:

    猜你喜欢
    • 2016-10-18
    • 2018-11-22
    • 2015-11-20
    • 2012-04-17
    • 2016-05-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-09-14
    相关资源
    最近更新 更多