0

PHP -IMAP 我已将所有 imap 邮件保存到数据库并从数据库中显示它们。我的问题是一封邮件显示“内容传输编码:base64”。如果我对其进行 base64 解码,那么其他邮件也会受到影响。到目前为止,我还无法将其更改为人类可读的格式。任何帮助将不胜感激。我尝试了很多解决方案,但我目前使用的代码是,

mb_convert_encoding($body, "ISO-8859-1", "UTF-8");

这封邮件的输出是

------=_NextPart_001_0606_012497BF.12408D60
Content-Type: text/plain;
charset="utf-8"
Content-Transfer-Encoding: base64

 OTA5MTU5Mzg3DQoNCuS7juaKgOacr+i1sOWQkeeuoeeQhueahOWbm+S4quaguOW/gw0KMjAxMi05
 LTE1ICAxNjowMjoxNw==

 ------=_NextPart_001_0606_012497BF.12408D60
 Content-Type: text/html;
charset="utf-8"
 Content-Transfer-Encoding: base64

 PCFET0NUWVBFIEhUTUwgUFVCTElDICItLy9XM0MvL0RURCBIVE1MIDQuMCBUcmFuc2l0aW9uYWwv
 L0VOIj4NCjxIVE1MPjxIRUFEPg0KPE1FVEEgY29udGVudD0idGV4dC9odG1sOyBjaGFyc2V0PXV0
 Zi04IiBodHRwLWVxdWl2PUNvbnRlbnQtVHlwZT4NCjxNRVRBIG5hbWU9R0VORVJBVE9SIGNvbnRl
 bnQ9Ik1TSFRNTCA4LjAwLjYwMDEuMTg5OTkiPjwvSEVBRD4NCjxCT0RZPg0KPFA+PEZPTlQgc2l6
 ZT0yPjkwOTE1OTM4NzxCUj48QlI+5LuO5oqA5pyv6LWw5ZCR566h55CG55qE5Zub5Liq5qC45b+D
 PC9GT05UPjwvUD4NCjxQPjxGT05UIHNpemU9Mj4yMDEyLTktMTUmbmJzcDsgMTY6MDI6MTc8L0ZP
 TlQ+PC9QPjwvQk9EWT48L0hUTUw+DQo=

 ------=_NextPart_001_0606_012497BF.12408D60--
4

2 回答 2

0

它是 base64,你必须像这样在 body 部分使用 base64_decode:

base64_decode('OTA5MTU5Mzg3DQoNCuS7juaKgOacr+i1sOWQkeeuoeeQhueahOWbm+S4quaguOW/gw0KMjAxMi05LTE1ICAxNjowMjoxNw==');
于 2012-09-18T11:17:57.693 回答
-3

只是手动检查有几个在线服务,如 http://www.motobit.com/util/base64-decoder-encoder.asp

只需复制并粘贴 base64 源并选择“解码”。你会得到一个“人类可用的格式”。

于 2012-09-18T14:07:44.820 回答