Retrieving email: Gmail-PHP-IMAP -


i using imap protocol fetch inbox emails small php app writing.

i getting error message:

fatal error: allowed memory size of 33554432 bytes exhausted (tried allocate 13055589 bytes) in /home/admin/public_html/boltmail/inbox.php on line 56

but if @ error not make lot of sense.....it says allowed memory size 33mb , needed 13mb allocate data.....

php code:

    <?php  /* connect gmail */ $hostname = '{imap.gmail.com:993/imap/ssl}inbox'; $username = 'tomasz@*****.com'; $password = '*****';  /* try connect */ $inbox = imap_open($hostname,$username,$password) or die('cannot connect gmail: ' . imap_last_error());  /* grab emails */ $emails = imap_search($inbox,'all');  /* if emails returned, cycle through each... */ if($emails) {      /* begin output var */     $output = '';      /* put newest emails on top */     rsort($emails);      /* every email... */     foreach($emails $email_number) {          /* information specific email */         $overview = imap_fetch_overview($inbox,$email_number,0);         $message = imap_fetchbody($inbox,$email_number,2);          /* output 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 email body */         $output.= '<div class="body">'.$message.'</div>';     }      echo $output; }  /* close connection */ imap_close($inbox);     ?> 

besides using tutorial import gmail emails: tutorial link

the error message may confusing, make sense: php tried allocate 13 mb, on top of 32 mb allowed. need @ least 45 mb. first of all, increase memory limit, should problem.


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -