PHP mail():标头出现在邮件正文中
我目前正在 Linux 服务器上使用 php 开发邮件应用程序,但遇到问题。将电子邮件发送到具有不同客户端的一堆不同地址后,有时收件人无法阅读这些邮件。 例如,正文似乎以此开头:
boundary="=_2cac04098ebf51c342bd57eab2200e38"
Message-ID: <lo5huc.id4ip6qutsch.lforce.de>
Date: Mon, 11 Jul 2011 06:01:24 +0200 (CEST)
--=_2cac04098ebf51c342bd57eab2200e38
我真的不知道我的邮件发生了什么事。标头中的每一行均由 \n
分隔,边界条目有一个前导 \t
。尽管客户端似乎在解析我的标头时读取了不存在的换行符。它也发生在标头的其他部分。
有人遇到过类似的问题吗?请帮我!
安迪
更新:我很确定这不是编码错误。我多年来一直在编写这个邮件内容(甚至编写了我自己的邮件客户端)并且它运行得很好。现在我们使用 RMAIL 类,它也来自一个更大的开源项目。我认为这更像是我的系统配置的问题......但这只是一个猜测。
I have a problem with a mailing application I'm currently developing with php on a linux server. After sending an email to a bunch of different addresses with different clients on it, sometimes these mails can't be read by the receivers.
For example the body appears to start with this:
boundary="=_2cac04098ebf51c342bd57eab2200e38"
Message-ID: <lo5huc.id4ip6qutsch.lforce.de>
Date: Mon, 11 Jul 2011 06:01:24 +0200 (CEST)
--=_2cac04098ebf51c342bd57eab2200e38
I really have no clue what's happening to my mails. Each line in the header is separated by \n
, the boundary entry has a leading \t
. Though the client seems to read a line break which is not there while parsing my header. It also happens in other parts of the header.
Has anyone ever had a similar problem? Please help me!
Andy
UPDATE: I'm pretty sure it's no coding error. I've been coding this mail stuff for years (even wrote my own mail client) and it worked perfectly. Right now we use the RMAIL class which is also from a bigger open source project. I think it's more like a problem with my system configuration... but that's just a guess.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
确保正确分隔每个标题行,例如:
Make sure you seperate every header line correctly, for instance:
我建议使用 PHPMailer,易于使用,可以处理所有必要的标头,轻松发送附件,多个收件人等。
http://phpmailer.worxware.com/index.php?pg=phpmailer
I suggest using PHPMailer, easy to use, takes care of all nesseccery headers, easy attachment sending, multiple recipients etc.
http://phpmailer.worxware.com/index.php?pg=phpmailer