无法在 php 中使用 imap 搜索单独获取和显示 gmail 内部正文或消息?

问题描述

无法在 PHP 中使用 imap 搜索单独获取显示 gmail 内部正文或邮件

如何在表 tr 中分别显示 Gmail 内部正文或邮件

这是我的代码

/* Connecting Gmail server with IMAP */
$connection = imap_open('{imap.gmail.com:993/imap/ssl}INBox','test@gmail.com','test@123') 
or die('Cannot connect to Gmail: ' . imap_last_error());

/* Search Emails having the specified keyword in the email subject */
$emailData = imap_search($connection,'UNSEEN');

if (! empty($emailData)) {
foreach ($emailData as $emailIdent) {
$overview = imap_fetch_overview($connection,$emailIdent,0);
$message = imap_fetchbody($connection,'1.1');
$messageExcerpt = substr($message,150);
$partialMessage = trim(quoted_printable_decode($messageExcerpt));
$date = date("d F,Y",strtotime($overview[0]->date));
?>

  <tr>
  <td><?PHP echo $overview[0]->from; ?></td>
  <td><?PHP echo $overview[0]->subject; ?> - <?PHP echo $partialMessage; ?></td>
  <td><?PHP echo $date; ?></td>
  <td><?PHP echo $message ; ?></td>
  </tr>
  <?PHP
  }
  }
  imap_close($connection);
  } //end if

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)