Código PHP:
$link = connect("pop3.xxx.com","[email protected]","xxx");
$headers=imap_headers($link);
for($x=1; $x <= count($headers); $x++)
{
/* get information specific to this email */
$overview = imap_fetch_overview($link,$x,0);
$message = imap_fetchbody($link,$x,2);
/* 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>';
/* output the email body */
$output.= '<div class="body">'.$message.'</div>';
}
echo $output;