如何删除html邮件中的随机空格


How to remove random spaces in html mail?

我在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));

请帮帮我,提前谢谢。

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

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