I have a testing list in my database of 50 addresses and all addresses are properly composed with the appropriate email address inserted where {EMAIL_ADDRESS} is in the email. However, I have a real list in my database with ~1000 recipients and when I send to this, the replacement works at first, but then seems to get stuck on one address and all emails after that get replaced with this same address. I am not sure what is going on and testing is obviously difficult because I only get to send these when I have something to send out to my real list.
I know the code in the replacement class is a little funky, but as I said, it does work until it gets stuck on this one address. I have looked at the sending process with verbose sending enabled and there is a considerable pause in the sending at the email address before the one that hijacks all subsequent replacements.
I am also using the Swift_Cache_Disk and AntiFlood plugins in case that helps.
I have not tested it with the $address = strtolower($address); line - I only just added that, but there are no email addresses in the vicinity of the one in question that have any uppercase characters, although there are some elsewhere in the database. Mind you, I added an email address with uppercase characters to my testing list and there were no problems.
Thanks for any help - have been going nuts trying to figure this one out.
Code: Select all
//Extend the replacements class
class Replacements extends Swift_Plugin_Decorator_Replacements {
function getReplacementsFor($address) {
$address = strtolower($address);
$result['{EMAIL_ADDRESS}'] = $address;
return $result;
}
}
$query_emails = "SELECT email_address FROM $email_list WHERE seminar_online = '1'";
$emails = mysql_query($query_emails) or die(mysql_error());
while($row_emails = mysql_fetch_assoc($emails)){
$recipients->addTo($row_emails['email_address']);
}
//Load the plugin with the extended replacements class
$swift->attachPlugin(new Swift_Plugin_Decorator(new Replacements()), "decorator");
}