Skip to content

Instantly share code, notes, and snippets.

@alister
Created November 22, 2011 15:59
Show Gist options
  • Save alister/1385998 to your computer and use it in GitHub Desktop.
Save alister/1385998 to your computer and use it in GitHub Desktop.
<?php
// bootstrap the DB access and configs...
// .....
$m = new ParseBounces();
require_once 'Zend/Mail/Storage/Maildir.php';
try {
$mail = new Zend_Mail_Storage_Maildir(
array('dirname' => $bounceMaildir)
);
} catch (Zend_Mail_Exception $e) {
die ("can't open the maildir");
}
echo $mail->countMessages() . " messages found\n";
foreach ($mail as $message) {
// is it spam?
if ($m->isspam($message)) {
// delete the message
}
if ($emails = $m->isBounce($message)) {
// set a flag for the emails return,
// then delete the message
}
// we don't know what it is, leave it there.
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment