PHP 发送的邮件有 =0A=0A 而不是换行 [英] PHP sent emails have =0A=0A instead of new lines

查看:19
本文介绍了PHP 发送的邮件有 =0A=0A 而不是换行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一段时间以来,我遇到了一些用户收到 =0A=0A 而不是我通过 PHP 发送给他们的电子邮件中的新行的问题.通过电子邮件客户端的通信效果很好,但 PHP 生成的电子邮件对于某些用户(少数)来说总是这样.谷歌搜索没有发现像样的结果,所有搜索结果似乎都以某种方式与 Outlook 相关 - 认为所有 Outlook 用户都会遇到这个问题是不可接受的.有谁知道处理这个问题和避免这些新行编码问题的正确方法吗?

For some time now I've had the problem of some of my users getting =0A=0A instead of new lines in emails I send to them via PHP. Correspondence via email client works well, but PHP generated emails always look like this with some users (a minority). Googling revealed no decent results, all search results seem to be connected with outlook somehow - and it is unacceptable to think that all outlook users would suffer from this problem. Does anyone know a correct way of handling this and avoiding these new line encoding issues?

仅供参考,我正在使用 Zend 的 Mailer 类.

FYI I'm using Zend's Mailer class.

谢谢

编辑 2:

更改编码类型无效.我将标头编码为 base64,将正文编码为 64,结果出现乱码.然后我尝试使用 base64 标头,并在正文上执行 base64_decode(base64_decode($body)) ,这在用户的CNR 服务器但不在收件箱中"上很好,无论这意味着什么.当我尝试将 mb_convert_encoding 转换为 base64 时,我再次得到了编码字符串而不是正文,所以没有用.

Changing the encoding type did not work. I encoded the headers to base64, and the body to 64, got garbled stuff. Then I tried with base64 headers, and did base64_decode(base64_decode($body)) on the body, and that was fine on the user's "CNR Server but not in the inbox" whatever that means. When I tried mb_convert_encoding to base64, I got the encoded string instead of the body again, so no use.

我还能尝试什么?Zend Mailer 仅支持 Quoted Printable 和 Base64 标头编码.不知道如何处理正文以匹配引用的可打印编码...

What else can I try? Zend Mailer only supports Quoted Printable and Base64 header encoding. Not sure what to do to the body for it to match the quoted printable encoding...

推荐答案

电子邮件正文已使用 quoted-printable - 但邮件中声明的 mime 类型是 text/html(或 text/plain 或 undefined).

The email body has been encoded using quoted-printable - but the mime type declared in the email is text/html (or text/plain or undefined).

如何使电子邮件正文的编码与 MIME 标头匹配取决于您.

How you make the encoding of the body of the email match the mime header is up to you.

这篇关于PHP 发送的邮件有 =0A=0A 而不是换行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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