这是我的PHP代码:
<?php
$host = 'xxxxx.com';
$username = 'xxxxx@ies-nusantara.com';
$password = 'xxxxxx';
/* try to connect */
$inbox = imap_open("{".$host."/pop3/novalidate- cert}INBOX",$username,$password) or die('Cannot connect to sERVER: ' . imap_last_error());
$emails = imap_search($inbox,'ALL');
if($emails)
{
/* begin output var */
$output = '';
/* put the newest emails on top */
rsort($emails);
/* for every email... */
foreach($emails as $email_number)
{
/* get information specific to this email */
$overview = imap_fetch_overview($inbox,$email_number,0);
/* output the email header information */
$output.= '<div class="toggler '.($overview[0]->seen ? 'read' : 'unread').'">';
$output.= '<span class="subject">'.$overview[0]->subject.'</span> ';
$output.= '<span class="from">'.$overview[0]->from.'</span>';
$output.= '<span class="date">on '.$overview[0]->date.'</span>';
$output.= '</div>';
$body = imap_fetchbody($overview[0]->msgno,1.2);
$output.= '<div class="body">'.$body.'</div>';
}
echo $output;
}
如何阅读正文电子邮件并保存附件电子邮件,
我尝试使用函数imap_fetchbody
,但错误..
请帮帮我。