
Originally Posted by
agupta Pine,
If you see the bounced emails in the sugar application then it means they have already been processed using the bounced handling logic.
if the emails are sitting in your email box then you should make sure that cron job is running and review timing of this scheduled job: Run Nightly Process Bounced Campaign Emails.
-Ajay
I had to change more code in ProcessBouncedEmails.php to get the bounced emails to show up. But they ARE showing up now! YeeHaw!
Code:
$where="campaign_log.activity_type='targeted' and campaign_log.target_tracker_key='{$identifier}'";
$query=$targeted->create_list_query('',$where);
$result=$targeted->db->query($query);
$row=$targeted->db->fetchByAssoc($result);
if (!empty($row)) {
$GLOBALS['log']->debug('-----> PSVP: Campaign: first row is not empty : target_tracker_key '.$row['target_tracker_key']);
//found entry
//do not create another campaign_log record if we already have an
//invalid email or send error entry for this tracker key.
$query = "select * from campaign_log where target_tracker_key='{$row['target_tracker_key']}'";
$query .=" and (activity_type='invalid email' or activity_type='send error')";
$result=$targeted->db->query($query);
$row1=$targeted->db->fetchByAssoc($result);
if (empty($row1)) {
$GLOBALS['log']->debug('-----> PSVP: Campaign: second row is empty');
$bounce = new CampaignLog();
$bounce->campaign_id=$row['campaign_id'];
$bounce->target_tracker_key=$row['target_tracker_key'];
$bounce->target_id= $row['target_id']; The significant changes that I made were to change the logic from " if (!empty($row)) {" to " if(empty($row1)){" and on the previous ling I changed the variable to $row1 from $row. According the the comments (THANK YOU FOR COMMENTED CODE!!!) it is looking to see if a record already exists. If a record already exists (as determined by an empty check) then the code is skipped. The code was checking to see if the row was NOT empty, so this section of code was never executing when it should have been because there is no bounced record because it is that very bounce record that it is processing.
The other change that I made to the code was to change the second "$row" variable to "$row1" because once we got inside the bounce email checking code nothing was happening because the re-use of the $row variable had overwritten the first $row variable, the first one having the data that we needed.
Hope this helps.
Thanks for all the hard work. Sugar is a great product, and only getting better.
Bookmarks