我正在尝试从特定的电子邮件ID中获取所有收到的电子邮件,例如(来自:abc@gmail.com),这是我成功获得的。 现在我期待收到这封电子邮件的所有消息,即Re:sub fw:,Re:Re ....
这是我正在尝试的方式
$username = 'myemail@gmail.com';
$password = 'mypassword';
$folder = 'INBOX';
$email_resp = $this->config_imap($username,$password,$folder);
$email_list = $email_resp['emails'];
$inbox = $email_resp['inbox'];
$student_email = $useremail;
$email_list = imap_search($inbox, "FROM '{$student_email}'");
$threads = imap_thread($inbox);
rsort($email_list);
if(sizeof($email_list)>0){
foreach ($email_list as $key => $value) {
$overview = imap_fetch_overview($inbox,$value,0);
$message = imap_fetchbody($inbox,$value,2);
$attachment = imap_fetchstructure($inbox,$value);
$threads = imap_thread($inbox);
$thread_detail = array(
$value.".num" => $threads[$value.".num"],
$value.".next" => $threads[$value.".next"],
$value.".branch" => $threads[$value.".branch"],
);
foreach ($thread_detail as $k => $v) {
$tree =explode('.',$k);
if($tree[1]=='num'){
$headerInfo=imap_headerinfo($inbox, $value);
}
}
echo json_encode($headerInfo);
die;
$overview[0]->email =$message;
$overview[0]->attachment =$attachment;
$emails[]=$overview;
}
echo json_encode($emails);
}
else{
return Response::json(array('fail'=>'No Email Found.'));
}
我如何获得关联的线程标题详细信息和消息正文。