Advertisement
Guest User

Untitled

a guest
Sep 26th, 2017
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. <?php
  2.  
  3. $date = date('y-m-d');
  4. $hostname = '';
  5. $username = '';
  6. $password = '';
  7.  
  8. $inbox = imap_open($hostname,$username,$password) or die('Cannot
  9. connect to mailbox: ' . imap_last_error());
  10. $emails = imap_search($inbox,'SUBJECT "Undelivered Mail Returned to Sender" ON "'.$date.'"');
  11.  
  12.  
  13. if($emails){
  14. rsort($emails);
  15. foreach($emails as $email){
  16. $overview = imap_fetch_overview($inbox,$email,0);
  17. $message = imap_body($inbox, $email);
  18. print_r($overview);
  19. print_r($message);
  20. echo '<br>';
  21.  
  22. print_r($email);
  23. }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement