Advertisement
Guest User

Untitled

a guest
Mar 23rd, 2017
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. <?php
  2. $hostname = '{imap.gmail.com:993/imap/ssl}INBOX';
  3. $username = 'joesta@gmail.com';
  4. $password = 'whatever';
  5.  
  6. echo $username;
  7. $inbox = imap_open($hostname, $username, $password) or die('connect error: ' . imap_last_error() );
  8. echo ' inbox: ' . $inbox . '<br>';
  9. $emails = imap_search($inbox, 'ALL' );
  10. if($emails) {
  11. rsort( $emails );
  12. foreach( $emails as $email ) {
  13. $overview = imap_fetch_overview( $inbox, $email, 0 );
  14. echo $overview[0]->subject;
  15. echo "<br>";
  16. }
  17. }
  18. imap_close( $inbox );
  19.  
  20. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement