Advertisement
Guest User

Untitled

a guest
Feb 14th, 2016
112
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.  
  3. $hostname = '{imap.gmail.com:993/imap/ssl}INBOX';
  4. $username = 'mikedray1983@gmail.com';
  5. $password = '********';
  6. $inbox = imap_open($hostname,$username,$password);
  7. $emails = imap_search($inbox,'ALL');
  8. foreach($emails as $e){
  9. $overview = imap_fetch_overview($inbox,$e,0);
  10. $message = imap_fetchbody($inbox,$e,2);
  11. // the body of the message is in $message
  12. $details = $overview[0];
  13. // you can do a var_dump($details) to see which parts you need
  14. //then do whatever to insert them into your DB
  15. }
  16.  
  17.  
  18. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement