Last active
February 10, 2016 19:49
-
-
Save lgaetz/11214737 to your computer and use it in GitHub Desktop.
Modification to phpList 2.0.5/6 for processing bounces from Amazon SES
This file contains hidden or 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 | |
/*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** | |
* Modification to file /admin/bounce.php to get subscriber email address * | |
* from Amazon SES bounce email warnings * | |
* Existing code lines 0 to 136 removed for clarity * | |
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***/ | |
$tables["user"],$guessedid)); // exist line 137 | |
$guessedemail = $emailreq[0]; // exist line 138 | |
} // exist line 139 | |
// these new lines will attempt to pull subscriber email address from the body of | |
// the Amazon SES bounce message using the regex defined | |
if ($guessedemail == '') { | |
$email_body = $bounce['data']; | |
$regex = '~{"bounceSubType":.*?,"bounceType":.*?.*?"bouncedRecipients".*?"emailAddress":"(.+?)"~'; | |
preg_match($regex,$email_body,$matches); | |
if ($matches[1][0]) { | |
$guessedemail = trim($matches[1]); | |
} | |
} | |
/* Remaining code removed for clarity | |
* | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment