问题描述
我试图获取使用电子邮件身体的特定部分:
I am trying to fetch a particular section of an email body using:
$message = imap_fetchbody ($imap_stream,$n,1);
这工作正常使用Outlook,Hotmail的,雅虎等发送的电子邮件但当我尝试并且可以从黑莓或安卓设备发送的电子邮件的正文中,该消息是EN codeD和炒,如:
This works fine for emails sent using Outlook, Hotmail, Yahoo etc. But when I try and fetch the body of the an email sent from a Blackberry or Andriod device, the message is encoded and scrambled such as:
xmb250IHN0eWxlPSdjb2xvcjojRjk3MWIxMDNiMTEyYjExOGI0N2I1MWI1
虽然机身是连接codeD,标题是好的。 如何做我去code从Android或黑莓设备发送的电子邮件连接邮件正文?
感谢您,
克里斯。
推荐答案
您应该能够运行 imap_fetchstructure 获得EN codeD值。如果该值等于3,你需要通过 imap_base64 脱code一>
You should be able to run imap_fetchstructure to get the encoded value. If that value equals 3 you need to decode via imap_base64.
我用之前以下(不记得,如果它与移动发送电子邮件之前,虽然测试过):
I've used the following before (Can't remember if it was ever tested with sent mobile email before though):
$structure = imap_fetchstructure($stream, $msgno);
$text = imap_fetchbody($stream, $msgno, $partnum);
if($structure->encoding == 3) {
$text = imap_base64($text);
} else if($structure->encoding == 4) {
$text = imap_qprint($text));
}
这篇关于imap_fetchbody - 恩codeD身体错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!