/** * Process the mailbox for all the settings from civicrm_mail_settings * * @param string $civiMail if true, processing is done in CiviMail context, or Activities otherwise. * @return void */ static function process($civiMail = true) { require_once 'CRM/Core/DAO/MailSettings.php'; $dao = new CRM_Core_DAO_MailSettings(); $dao->domain_id = CRM_Core_Config::domainID(); $dao->find(); while ($dao->fetch()) { EmailProcessor::_process($civiMail, $dao); } }
<script type="text/javascript"> function processEmails(){ document.getElementById("process_form").submit(); } window.onload=processEmails; </script> <?php } else { if ($senders) { echo '<br><b>Processing incoming emails from: ' . $senders . ':</b><br><br>'; } else { echo '<br><b>Processing incoming emails:</b><br><br>'; } $mail_processor = new EmailProcessor($server, $port, $username, $password, $use_ssl); echo '<table style="border: 1px solid black;">'; $mail_processor->process('add_email_as_record', $senders, $delete_processed); echo '</table><br>'; echo '<div><b>Total emails processed: ' . $emails_processed . '</b></div>'; echo '<div style="padding-left:20px"><b>Failed: ' . $emails_failed . '</b></div>'; echo '<div style="padding-left:20px"><b>Addedd: ' . ($emails_processed - $emails_failed) . '</b></div>'; if ($emails_processed - $emails_failed > 0) { echo '<div>You may look at the added records: <a href="../../search/search.html?db=' . HEURIST_DBNAME . '&q=ids:' . $emails_processed_ids . '" target="_blank"> <img src="../../common/images/external_link_16x16.gif"/>HERE</a></div>'; } } } catch (Exception $e) { echo '<b>Processing failed with the following message: ' . $e->getMessage() . '</b>'; echo "<p>If the user name and password or IMAP server details are incorrect, you may get 'Login aborted'</p>";
crm_mailer_event_unsubscribe($job, $queue, $hash); break; } } $store->markProcessed($key); } } } } } // bootstrap the environment and run the processor session_start(); require_once '../civicrm.config.php'; require_once 'CRM/Core/Config.php'; $config =& CRM_Core_Config::singleton(); CRM_Utils_System::authenticateScript(true); require_once 'CRM/Core/Lock.php'; $lock = new CRM_Core_Lock('EmailProcessor'); if ($lock->isAcquired()) { // try to unset any time limits if (!ini_get('safe_mode')) { set_time_limit(0); } // check if the script is being used for civimail processing or email to // activity processing. $isCiviMail = CRM_Utils_Array::value('emailtoactivity', $_REQUEST) ? false : true; EmailProcessor::process($isCiviMail); } else { throw new Exception('Could not acquire lock, another EmailProcessor process is running'); } $lock->release();