Skip to content

Instantly share code, notes, and snippets.

@lgaetz
Last active February 10, 2016 19:49
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lgaetz/11214737 to your computer and use it in GitHub Desktop.
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
<?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