@@ -360,25 +360,36 @@ function processBounceData($bounceid, $msgid, $userid, $bounceDate = null)
360360
361361function processPop ($ server , $ user , $ password )
362362{
363- $ port = $ GLOBALS ['bounce_mailbox_port ' ];
363+ global $ bounce_mailbox_port , $ bounce_mailbox_name , $ bounce_mailbox_maximum ;
364+
365+ $ port = $ bounce_mailbox_port ;
364366 if (!$ port ) {
365367 $ port = '110/pop3/notls ' ;
366368 }
367369 set_time_limit (6000 );
368370
369- $ link = imap_open ('{ ' .$ server .': ' .$ port .'}INBOX ' , $ user , $ password );
371+ $ mailboxNames = explode (', ' , $ bounce_mailbox_name );
372+ $ report = '' ;
370373
371- if (!$ link ) {
372- outputProcessBounce ($ GLOBALS ['I18N ' ]->get ('Cannot create POP3 connection to ' )." $ server: " .imap_last_error ());
374+ foreach ($ mailboxNames as $ mailboxName ) {
375+ $ mailbox = sprintf ('{%s:%s}%s ' , $ server , $ port , $ mailboxName );
376+ $ link = imap_open ($ mailbox , $ user , $ password );
373377
374- return false ;
378+ if (!$ link ) {
379+ outputProcessBounce ($ GLOBALS ['I18N ' ]->get ('Cannot create POP3 connection to ' )." $ mailbox: " .imap_last_error ());
380+
381+ return false ;
382+ }
383+ $ report .= processMessages ($ link , $ bounce_mailbox_maximum );
375384 }
376385
377- return processMessages ( $ link , 100000 ) ;
386+ return $ report ;
378387}
379388
380389function processMbox ($ file )
381390{
391+ global $ bounce_mailbox_maximum ;
392+
382393 set_time_limit (6000 );
383394
384395 if (!TEST ) {
@@ -392,10 +403,10 @@ function processMbox($file)
392403 return false ;
393404 }
394405
395- return processMessages ($ link , 100000 );
406+ return processMessages ($ link , $ bounce_mailbox_maximum );
396407}
397408
398- function processMessages ($ link , $ max = 3000 )
409+ function processMessages ($ link , $ max )
399410{
400411 global $ bounce_mailbox_purge_unprocessed , $ bounce_mailbox_purge ;
401412 $ num = imap_num_msg ($ link );
@@ -554,7 +565,7 @@ function processMessages($link, $max = 3000)
554565 $ bounceCount = Sql_Fetch_Row_Query (sprintf ('select count(*) from %s ' , $ GLOBALS ['tables ' ]['user_message_bounce ' ]));
555566 $ total = $ bounceCount [0 ];
556567 $ counter = 0 ;
557- $ batchSize = 500 ; //# @TODO make a config, to allow tweaking on bigger systems
568+ $ batchSize = $ bounce_rules_batch_size ;
558569 while ($ counter < $ total ) {
559570 $ limit = ' limit ' .$ counter .', ' .$ batchSize ;
560571 $ counter += $ batchSize ;
0 commit comments