Page 1 of 11 12345 ... LastLast
Results 1 to 10 of 103

Thread: Campaign not picking up bounced emails

  1. #1
    pinetree is offline Sugar Community Member
    Join Date
    Nov 2005
    Posts
    34

    Default Campaign not picking up bounced emails

    I have the inbound email possible action set to "Bounced", and in the group inbox, there are 50 bounced emails waiting to be picked up. Only one was as a Bounced, other.

    I am running 4.0.1a on a Gentoo box
    Apache 2.0.54
    MySQL 4.1.14
    PHP 4

    Any ideas about where I should start looking?

    Thanks,
    Pine

  2. #2
    agupta is offline Sugar Team Member
    Join Date
    May 2005
    Posts
    142

    Default Re: Campaign not picking up bounced emails

    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

  3. #3
    pinetree is offline Sugar Community Member
    Join Date
    Nov 2005
    Posts
    34

    Default Re: Campaign not picking up bounced emails

    Quote 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
    Okay, so I have checked, and I know that the job is running. What does the job look for? I went in and looked at the function, and I can't see where it would actually be checking for anything. It just looks like it is importing emails. (I included the entire function that is in my php file below.

    Code:
    function pollMonitoredInboxesForBouncedCampaignEmails() {
    	$GLOBALS['log']->info('----->Scheduler job of type pollMonitoredInboxesForBouncedCampaignEmails()');
    	global $dictionary;
    	require_once('modules/InboundEmail/InboundEmail.php');
    	
    	$ie = new InboundEmail();
    	$r = $ie->db->query('SELECT id FROM inbound_email WHERE deleted=0 AND status=\'Active\' AND mailbox_type=\'bounce\'');
    	
    	while($a = $ie->db->fetchByAssoc($r)) {
    		$ieX = new InboundEmail();
    		$ieX->retrieve($a['id']);
    		$ieX->connectMailserver();
    	
    		$newMsgs = $ieX->getNewMessageIds();
    		if(is_array($newMsgs)) {
    			foreach($newMsgs as $k => $msgNo) {
    				$ieX->importOneEmail($msgNo);
    			}
    		}
    		imap_expunge($ieX->conn);
    		imap_close($ieX->conn);
    	}
    	
    	return true;
    }
    The foreach loop seems to be the key, but it only appears to be importingOneEmail and not actually doing anything with the email. Am I missing something?

    Oh, and I also noticed that the runMassEmailCampaign job calls sugar_cleanup() even though the comments at the top of the file say not to do that. Should that be there? Is that why I have been having issues with getting massEmails to process?

    Sorry for the scattered post.

    Pine

  4. #4
    pinetree is offline Sugar Community Member
    Join Date
    Nov 2005
    Posts
    34

    Default Re: Campaign not picking up bounced emails

    Quote 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
    Okay, so I have done some more digging. I found that the sugarcrm.log file was getting the log "sender not MAILER-DAEMON" in the log file, even for the messages that I KNEW were from MAILER-DAEMON. I found that the regex's preg_match's and preg_splits in ProcessBouncedEmails.php were single-quoted (') ... I changed them to double-quotes (") and now I am dropping into the if-else-if's of the bounced email processing function.

    I'm still not seeing the bounced email showing up, but I am getting closer. I think that I may have some database things going on.

    Pine

  5. #5
    pinetree is offline Sugar Community Member
    Join Date
    Nov 2005
    Posts
    34

    Default Re: Campaign not picking up bounced emails

    Quote 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.

  6. #6
    ianstapleton is offline Sugar Community Member
    Join Date
    Feb 2006
    Posts
    27

    Default Re: Campaign not picking up bounced emails

    Pine

    Excellent find - I've just spent 2 hours trying to trace why bounced emails were not being picked up in the Campaign logs. Stumbled across this thread- boy I wish found it earlier

    Can any of the Sugar dev team confirm this is now a known issue and is being fixed (I see there is a lot of "TODO"'s in the code around the inbound email and campaign tracking area)

  7. #7
    hey2176 is offline Sugar Community Member
    Join Date
    Mar 2006
    Posts
    11

    Default Re: Campaign not picking up bounced emails

    I have this same issue where it's not picking up the bounced emails. They are ending up in the General Mailbox so I know they are being picked up out of the mailbox. I tried making these code changes to the PHP script but still can't figure out why it's not picking up the MAILER-DAEMON tag. I also don't see anything in the logs. Any other suggestions?

    Thanks!

  8. #8
    lchec is offline Junior Member
    Join Date
    Apr 2006
    Posts
    4

    Default Re: Campaign not picking up bounced emails

    Same issue for me ! Bounces are shown in the group mailbox but NOT processed as bounces in the campaign status...

    I can't believe we are only 2 guys in this situation.

    Any advice would be more than welcome.

    Best regards,

    Laurent

  9. #9
    agupta is offline Sugar Team Member
    Join Date
    May 2005
    Posts
    142

    Default Re: Campaign not picking up bounced emails

    lchec,

    please make sure that you do not have more than one monitored mailbox pointing at the same email account.
    The maiblox that you used to send campaign emails is still of the type "bounce handling", right?

    -Ajay

    Quote Originally Posted by lchec
    Same issue for me ! Bounces are shown in the group mailbox but NOT processed as bounces in the campaign status...

    I can't believe we are only 2 guys in this situation.

    Any advice would be more than welcome.

    Best regards,

    Laurent

  10. #10
    stasila is offline Sugar Community Member
    Join Date
    Dec 2005
    Posts
    22

    Default Re: Campaign not picking up bounced emails

    I got same problem for months
    I monitoring to different mailboxes, both setup for Bounce Handling
    Every time I invoke cron.php I can see bounced massages coming in group inbox,but nothing under campaign status.
    If some one found the way to resolve this issue please post it on the forum.
    Thank you.

Page 1 of 11 12345 ... LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •