Advertisement
Guest User

Untitled

a guest
Jul 2nd, 2017
513
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.79 KB | None | 0 0
  1. $label = 'hardbounce';
  2. $hostname = "{imap.gmail.com:993/imap/ssl}$label";
  3. $username = 'support@quizlet.com';
  4. $password = 'XXXX';
  5.  
  6. $imap_stream = imap_open($hostname,$username,$password) or die('Cannot connect to Gmail: ' . imap_last_error());
  7. $emails = imap_search($imap_stream, 'ALL');
  8. print "Total $label messages: " . count($emails) . "\n";
  9.  
  10. $fh = fopen('hardbounces.log', 'a');
  11. foreach ($emails as $email):
  12.     $body = imap_fetchbody($imap_stream, $email, '1');
  13.     fwrite($fh, "$body\n==hardbounce==\n");
  14.     if ($email % 100 == 0):
  15.         print "Grabbed $email messages\n";                                                                                                                                                                      
  16.     endif;
  17. endforeach;
  18.  
  19. fclose($fh);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement