Okay, this code \'was\' working perfectly and then I started playing around with it in order to let others connect to their e-mails and as you do ran into a few open stream
I have tried this an works perfectly fine for me
$inbox = imap_open("{imap.gmail.com:993/imap/ssl/novalidate-cert/norsh}Inbox", 'username', 'password')
or die('Cannot connect to Gmail: ' . 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);
$message = imap_fetchbody($inbox,$email_number,2);
$header = imap_header($inbox, $email_number);
echo "data
";
echo "";print_r($message);
echo "Message
";
echo "";print_r($message);
echo "header
";
echo "";print_r($message);
$overview[0]->seen;
$overview[0]->subject;
$overview[0]->from;
$overview[0]->date;
}
}
/* close the connection */
imap_close($inbox);