PHP邮件功能在消息文本中随机添加一个空格 [英] PHP mail function randomly adds a space to message text

查看:210
本文介绍了PHP邮件功能在消息文本中随机添加一个空格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个非常简单的PHP脚本,类似于:

I have a very simple PHP script, something like:

while ($condition){
    echo "<a href="thanks.php?id=".$id."> THANKS </a>";
}

当然,我还有更多代码,但这没关系.创建完这段代码后,脚本将向用户发送电子邮件.

Of course, I have a bit more code but it doesn't matter. Once I had created this piece of code, the script sends an email to the user.

收件箱

每行中的链接都可以,除了 LAST ONE 以这种方式显示链接:

The links are okay in every single line, except the LAST ONE shows the link this way:

    tha nks.php?id.....

它在代码之间添加了一个空格.

It adds a space in between the code.

这仅在hotmail中发生. Gmail,雅虎和其他所有工具都可以正常工作.

This only happens with hotmail. Gmail, yahoo, and everything else work just fine.

推荐答案

我知道这很晚了,但是有一个替代解决方案对我有用:

I know this is late but there is an alternate solution that worked for me:

使用此行使用base64对整个邮件进行编码:

Use this line to encode your entire message using base64:

$message = chunk_split(base64_encode($message));

然后,将其附加到标题:

Then, append this your header:

$headers .= "Content-Transfer-Encoding: base64\r\n\r\n";

这将告诉邮件客户端您的消息是base64编码的.

That will tell the mail client that your message is base64 encoded.

这篇关于PHP邮件功能在消息文本中随机添加一个空格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆