imap - How to get unread messages from server webmail in php -


i'm integrating webmail inbox access process. see code below. not unread message bring messages. how can unread messages kindly advice me.

$emails = imap_search($openmail, 'unseen'); 

see above line not working.

$authhost="{example.com:110/pop3}inbox"; $username="xxx@example.com"; $password="wxwxwxw";     ini_set('max_execution_time', 0);  /* try connect */ $inbox = imap_open($authhost,$username,$password) or die('cannot connect mail server: ' . imap_last_error());  /* grab emails */ $emails = imap_search($inbox, 'unseen'); // echo count($emails);exit;  /* if emails returned, cycle through each... */ if($emails) {      /* begin output var */     $output = '';     /* put newest emails on top */     // rsort($emails);     /* every email... */     // $count = 1;      foreach($emails $email_number) {         $head = imap_header($inbox, $email_number);              /* information specific email */         $overview = imap_fetch_overview($inbox,$email_number,0);          /*  echo "<pre>";         print_r($overview);exit;  */          $obj_thang = imap_headerinfo($inbox, $email_number);         // print_r($overview);exit;         $message = imap_body($inbox,$email_number,2);                  /* output email header information */                $output.= $obj_thang->subject;               //$output.= $obj_thang->fromaddress."<br/>";                 $output.= $obj_thang->reply_toaddress."<br/>";           }     echo $output; } 

you connecting pop3, not imap. pop3 not support server side search, nor concept of unseen vs seen messages.


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -