Advertisement
Guest User

Untitled

a guest
Jan 31st, 2016
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. protected function email()
  2. {
  3. $hostname = '{imap.gmail.com:993/imap/ssl/novalidate-cert}INBOX';
  4. $username = '*************';
  5. $password = '**********';
  6. /*Get all the data in $inbox*/
  7. $inbox = imap_open($hostname, $username, $password) or die('Cannot connect: ' . imap_last_error());
  8. /*collect ALL the messages in inbox*/
  9. $emails = imap_search($inbox, 'ALL');
  10. /*Collect unread messages only*/
  11. $emails_unread = imap_search($inbox, 'UNSEEN');
  12. /*Count rows from table 'Email'*/
  13. $row_count = count(Email::all());
  14.  
  15. $email_count = count($emails);
  16. $emails_unread_count = count($emails_unread);
  17. var_dump($emails_unread_count);
  18. die();
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement