Guest User

Untitled

a guest
May 11th, 2018
345
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. <?php
  2. $mailuser="user@gmail.com";
  3. $mailpass="password";
  4.  
  5. $mailhost="{imap.gmail.com:993/imap/ssl/novalidate-cert}INBOX";
  6.  
  7.  
  8. $mailbox = imap_open($mailhost,$mailuser,$mailpass) or die("<br />\nFAILLED! ".imap_last_error());
  9.  
  10. $emails = imap_search($mailbox,'ALL');
  11. $output = '';
  12. rsort($emails);
  13.  
  14.  
  15.  
  16. /* for every email... */
  17. foreach($emails as $email_number) {
  18.  
  19. /* get information specific to this email */
  20. $overview = imap_fetch_overview($mailbox,$email_number,0);
  21. $message = imap_fetchbody($mailbox,$email_number,2);
  22.  
  23. var_dump($overview[0]);
  24.  
  25. /* output the email header information */
  26. $output.= '<div class="toggler '.($overview[0]->seen ? 'read' : 'unread').'">';
  27. //$output.= '<span class="subject">'.$overview[0]->subject.'</span> ';
  28. $output.= '<span class="from">'.$overview[0]->from.'</span>';
  29. //$output.= '<span class="date">on '.$overview[0]->date.'</span>';
  30. $output.= '</div>';
  31.  
  32. /* output the email body */
  33. // $output.= '<div class="body">'.$message.'</div>';
  34. }
  35.  
  36. echo $output;
  37. imap_close($mailbox);
  38.  
  39.  
  40. ?>
Add Comment
Please, Sign In to add comment