Created
November 22, 2011 16:00
-
-
Save alister/1386002 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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