Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- protected function email()
- {
- $hostname = '{imap.gmail.com:993/imap/ssl/novalidate-cert}INBOX';
- $username = '*************';
- $password = '**********';
- /*Get all the data in $inbox*/
- $inbox = imap_open($hostname, $username, $password) or die('Cannot connect: ' . imap_last_error());
- /*collect ALL the messages in inbox*/
- $emails = imap_search($inbox, 'ALL');
- /*Collect unread messages only*/
- $emails_unread = imap_search($inbox, 'UNSEEN');
- /*Count rows from table 'Email'*/
- $row_count = count(Email::all());
- $email_count = count($emails);
- $emails_unread_count = count($emails_unread);
- var_dump($emails_unread_count);
- die();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement