foreach (array_keys($params) as $v) { if ($expr != '') { $expr .= ','; } $expr .= '`' . $v . '` = :' . $v; } $sql = 'INSERT INTO ' . LOG_BOUNCES_TABLE . ' SET ' . $expr . ' ON DUPLICATE KEY UPDATE dateinsert=NOW()'; //print $sql; $logquery = $db->prepare($sql); foreach (array_keys($params) as $v) { $logquery->bindParam(':' . $v, $params[$v]); } $logquery->execute(); // $error = $logquery->errorInfo(); // if ($error[0] != '00000') print_r($arr); } // objet BounceMailHandler $bmh = new BounceMailHandler(); // en mode test if ($testsend) { $bmh->testmode = true; // si on veux les corps de message //$bmh->debug_body_rule=true; //$bmh->debug_dsn_rule=true; // niveau de debug //$bmh->verbose=VERBOSE_DEBUG; } $bmh->action_function = 'bounceActionClean'; $bmh->log_bounces_function = 'logBounces'; $bmh->openPop3(BOUNCE_SERVER, BOUNCE_USER, BOUNCE_PASS); $bmh->processMailbox(BOUNCE_NB);
//require_once('callback samples/callback_csv.php'); // NOTE: Requires creation of a 'logs' directory and making writable // determine the current directory $dirTmp = getcwd(); // define the "base" directory of the application if (!defined('_PATH_BMH')) { $dirTmp = $_SERVER['DOCUMENT_ROOT'] . '/' . $dirTmp; if (strlen(substr($dirTmp, strlen($_SERVER['DOCUMENT_ROOT']) + 1)) > 0) { define('_PATH_BMH', substr($dirTmp, strlen($_SERVER['DOCUMENT_ROOT']) + 1) . "/"); } else { define('_PATH_BMH', ''); } } // END determine the current directory include _PATH_BMH . 'class.phpmailer-bmh.php'; // testing examples $bmh = new BounceMailHandler(); //$bmh->action_function = 'callbackAction'; // default is 'callbackAction' //$bmh->verbose = VERBOSE_SIMPLE; //VERBOSE_REPORT; //VERBOSE_DEBUG; //VERBOSE_QUIET; // default is VERBOSE_SIMPLE //$bmh->use_fetchstructure = true; // true is default, no need to speficy //$bmh->testmode = false; // false is default, no need to specify //$bmh->debug_body_rule = false; // false is default, no need to specify //$bmh->debug_dsn_rule = false; // false is default, no need to specify //$bmh->purge_unprocessed = false; // false is default, no need to specify //$bmh->disable_delete = false; // false is default, no need to specify /* * for local mailbox (to process .EML files) */ //$bmh->openLocal('/home/email/temp/mailbox'); //$bmh->processMailbox(); /* * for remote mailbox
<li><?php echo "BMH mail username - {$bmh_mailbox_username}"; ?> </li> <li><?php $dirTmp = getcwd(); // define the "base" directory of the application if (!defined('_PATH_BMH')) { $dirTmp = $_SERVER['DOCUMENT_ROOT'] . '/' . $dirTmp; if (strlen(substr($dirTmp, strlen($_SERVER['DOCUMENT_ROOT']) + 1)) > 0) { define('_PATH_BMH', substr($dirTmp, strlen($_SERVER['DOCUMENT_ROOT']) + 1) . "/bmh/"); } else { define('_PATH_BMH', ''); } } include _PATH_BMH . 'class.phpmailer-bmh.php'; $bmh = new BounceMailHandler(); $bmh->mailhost = $bmh_mailhost; $bmh->mailbox_username = $bmh_mailbox_username; $bmh->mailbox_password = $bmh_mailbox_password; $bmh->port = $bmh_port; $bmh->service = $bmh_service; $bmh->service_option = $bmh_service_option; $bmh->boxname = $bmh_boxname; $bmh->verbose = VERBOSE_QUIET; if ($bmh->openMailbox()) { echo "BMH mailbox succesfully opened."; imap_close($bmh->_mailbox_link); } else { echo "BMH mailbox could not be opened. Please verify the settings."; }