Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $hostname = '{imap.gmail.com:993/imap/ssl}INBOX';
- $username = 'joesta@gmail.com';
- $password = 'whatever';
- echo $username;
- $inbox = imap_open($hostname, $username, $password) or die('connect error: ' . imap_last_error() );
- echo ' inbox: ' . $inbox . '<br>';
- $emails = imap_search($inbox, 'ALL' );
- if($emails) {
- rsort( $emails );
- foreach( $emails as $email ) {
- $overview = imap_fetch_overview( $inbox, $email, 0 );
- echo $overview[0]->subject;
- echo "<br>";
- }
- }
- imap_close( $inbox );
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement