Hi guys I'm working on a google apps application. Basically I've set it up so users can add multiple gmail addresses and check on their inboxes in the application. It works fine with a google apps email address however when I add a gmail address it just dies out.
I'm using this code here:
$mail = new Zend_Mail_Storage_Imap($mail_options);
$all_messages = array();
$page = isset($_GET['page'])?$_GET['page']:1;
$limit = isset($_GET['limit'])?$_GET['limit']:20;
$offset = (($page-1)*$limit)+1;
$end = ($page*$limit)>$c?$c:($page*$limit);
for ($i=$offset;$i<=$end;$i++){
$h2t = new html2text();
$h2t->set_allowed_tags('<a>');
if(!$mail[$i])
break;
else{
$one_message = $mail->getMessage($i);
$one_message->id = $i;
$one_message->UID = $mail->getUniqueId($i);
$one_message->parts = array();
$one_message->body = '';
$count = 1;
foreach (new RecursiveIteratorIterator($mail->getMessage($i)) as $ii=>$part) {
try {
$tpart = $part;
//$tpart->_content = '';
$one_message->parts[$count] = $tpart;
$count++;
// check for html body
if (strtok($part->contentType, ';') == 'text/html') {
$b = $part->getContent();
if($part->contentTransferEncoding == 'quoted-printable')
$b = quoted_printable_decode($b);
$one_message->html_body = $b;
$h2t->set_html($b);
$one_message->body = $h2t->get_text();
}
//check for text body
if (strtok($part->contentType, ';') == 'text/plain') {
$b = $part->getContent();
if($part->contentTransferEncoding == 'quoted-printable')
$b = quoted_printable_decode($b);
$one_message->text_body = $b;
$one_message->body = $b;//$part->getContent();
}
} catch (Zend_Mail_Exception $e) {
// ignore
}
}
$all_messages[] = $one_message;
}
}
No matter what the emails it dies out on retrieving just 2 emails... whats going on here?