douzhan1935 2018-08-03 15:07
浏览 42

GMail imap_fetchbody不起作用

I'm trying to read an email body from gmail with imap_fetchbody and PHP, but it does not work, it does not print the body.

The mail has attachments and its Mime-type is text/html.
This is my code (with other kind of email, it works):

$string = quoted_printable_decode(imap_fetchbody($con,$email,2));

This is my PHP code:

$con is imap_open($server, $login, $password); 
$email are email from imap_search all code is;
$connessione = imap_open($server, $login, $password); 
$emails = imap_search($connessione, 'UNSEEN FROM "cc@cc.com"'); 
if (!empty($emails)) 
{ 
  foreach ($emails as $email) 
  { 
    $string = quoted_printable_decode(imap_fetchbody($connessione,$email,2)); 
  } 
}

$string is this: ----boundary_13267_d232a838-e6ee-4fb8-bc76-85484f4b0772 Content-Type: text/html Content-Transfer-Encoding: base64 Cgo8aHRtbD4KPGhlYWQ+CjxNRVRBIGh....

Can someone help me?

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 下图接收小电路,谁知道原理
    • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
    • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
    • ¥15 手机接入宽带网线,如何释放宽带全部速度
    • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
    • ¥15 ETLCloud 处理json多层级问题
    • ¥15 matlab中使用gurobi时报错
    • ¥15 这个主板怎么能扩出一两个sata口
    • ¥15 不是,这到底错哪儿了😭
    • ¥15 2020长安杯与连接网探