Skip to content

Instantly share code, notes, and snippets.

@alister
Created November 22, 2011 16:00
Show Gist options
  • Save alister/1386002 to your computer and use it in GitHub Desktop.
Save alister/1386002 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/Writeable.php';
try {
$mail = new Zend_Mail_Storage_Maildir_Writeable(
array('dirname' => $bounceMaildir)
);
} catch (Zend_Mail_Exception $e) {
die ("can't open the maildir");
}
echo $mail->countMessages() . " messages found\n";
foreach ($mail as $num=>$message) {
// is it spam?
if ($m->isspam($message)) {
$mail->removeMessage($num); // delete the message
}
if ($emails = $m->isBounce($message)) {
// set a flag for the emails return, then delete the message
$member->setEmailFlag($emails, time());
$mail->removeMessage($num);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment