本文整理匯總了PHP中InboundEmail::getNewMessageIds方法的典型用法代碼示例。如果您正苦於以下問題:PHP InboundEmail::getNewMessageIds方法的具體用法?PHP InboundEmail::getNewMessageIds怎麽用?PHP InboundEmail::getNewMessageIds使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類InboundEmail
的用法示例。
在下文中一共展示了InboundEmail::getNewMessageIds方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: header
}
header('Location: index.php?module=Emails&action=ListView&type=inbound&assigned_user_id=' . $current_user->id);
} elseif (isset($_REQUEST['type']) && $_REQUEST['type'] == 'group') {
$ie = new InboundEmail();
// this query only polls Group Inboxes
$r = $ie->db->query('SELECT inbound_email.id FROM inbound_email JOIN users ON inbound_email.group_id = users.id WHERE inbound_email.deleted=0 AND inbound_email.status = \'Active\' AND mailbox_type != \'bounce\' AND users.deleted = 0 AND users.is_group = 1');
while ($a = $ie->db->fetchByAssoc($r)) {
$ieX = new InboundEmail();
$ieX->retrieve($a['id']);
$ieX->connectMailserver();
//$newMsgs = $ieX->getNewMessageIds();
$newMsgs = array();
if ($ieX->isPop3Protocol()) {
$newMsgs = $ieX->getPop3NewMessagesToDownload();
} else {
$newMsgs = $ieX->getNewMessageIds();
}
if (is_array($newMsgs)) {
foreach ($newMsgs as $k => $msgNo) {
$uid = $msgNo;
if ($ieX->isPop3Protocol()) {
$uid = $ieX->getUIDLForMessage($msgNo);
} else {
$uid = imap_uid($ieX->conn, $msgNo);
}
// else
$ieX->importOneEmail($msgNo, $uid);
}
}
imap_expunge($ieX->conn);
imap_close($ieX->conn);
示例2: pollMonitoredInboxes
/**
* Job 1
*/
function pollMonitoredInboxes()
{
$_bck_up = array('team_id' => $GLOBALS['current_user']->team_id, 'team_set_id' => $GLOBALS['current_user']->team_set_id);
Log::info('----->Scheduler fired job of type pollMonitoredInboxes()');
global $dictionary;
global $app_strings;
require_once 'modules/Emails/EmailUI.php';
$ie = new InboundEmail();
$emailUI = new EmailUI();
$r = $ie->db->query('SELECT id, name FROM inbound_email WHERE is_personal = 0 AND deleted=0 AND status=\'Active\' AND mailbox_type != \'bounce\'');
Log::debug('Just got Result from get all Inbounds of Inbound Emails');
while ($a = $ie->db->fetchByAssoc($r)) {
Log::debug('In while loop of Inbound Emails');
$ieX = new InboundEmail();
$ieX->retrieve($a['id']);
$GLOBALS['current_user']->team_id = $ieX->team_id;
$GLOBALS['current_user']->team_set_id = $ieX->team_set_id;
$mailboxes = $ieX->mailboxarray;
foreach ($mailboxes as $mbox) {
$ieX->mailbox = $mbox;
$newMsgs = array();
$msgNoToUIDL = array();
$connectToMailServer = false;
if ($ieX->isPop3Protocol()) {
$msgNoToUIDL = $ieX->getPop3NewMessagesToDownloadForCron();
// get all the keys which are msgnos;
$newMsgs = array_keys($msgNoToUIDL);
}
if ($ieX->connectMailserver() == 'true') {
$connectToMailServer = true;
}
// if
Log::debug('Trying to connect to mailserver for [ ' . $a['name'] . ' ]');
if ($connectToMailServer) {
Log::debug('Connected to mailserver');
if (!$ieX->isPop3Protocol()) {
$newMsgs = $ieX->getNewMessageIds();
}
if (is_array($newMsgs)) {
$current = 1;
$total = count($newMsgs);
require_once "include/SugarFolders/SugarFolders.php";
$sugarFolder = new SugarFolder();
$groupFolderId = $ieX->groupfolder_id;
$isGroupFolderExists = false;
$users = array();
if ($groupFolderId != null && $groupFolderId != "") {
$sugarFolder->retrieve($groupFolderId);
$isGroupFolderExists = true;
}
// if
$messagesToDelete = array();
if ($ieX->isMailBoxTypeCreateCase()) {
$users[] = $sugarFolder->assign_to_id;
$distributionMethod = $ieX->get_stored_options("distrib_method", "");
if ($distributionMethod != 'roundRobin') {
$counts = $emailUI->getAssignedEmailsCountForUsers($users);
} else {
$lastRobin = $emailUI->getLastRobin($ieX);
}
Log::debug('distribution method id [ ' . $distributionMethod . ' ]');
}
foreach ($newMsgs as $k => $msgNo) {
$uid = $msgNo;
if ($ieX->isPop3Protocol()) {
$uid = $msgNoToUIDL[$msgNo];
} else {
$uid = imap_uid($ieX->conn, $msgNo);
}
// else
if ($isGroupFolderExists) {
if ($ieX->importOneEmail($msgNo, $uid)) {
// add to folder
$sugarFolder->addBean($ieX->email);
if ($ieX->isPop3Protocol()) {
$messagesToDelete[] = $msgNo;
} else {
$messagesToDelete[] = $uid;
}
if ($ieX->isMailBoxTypeCreateCase()) {
$userId = "";
if ($distributionMethod == 'roundRobin') {
if (sizeof($users) == 1) {
$userId = $users[0];
$lastRobin = $users[0];
} else {
$userIdsKeys = array_flip($users);
// now keys are values
$thisRobinKey = $userIdsKeys[$lastRobin] + 1;
if (!empty($users[$thisRobinKey])) {
$userId = $users[$thisRobinKey];
$lastRobin = $users[$thisRobinKey];
} else {
$userId = $users[0];
$lastRobin = $users[0];
}
}
//.........這裏部分代碼省略.........
示例3: pollMonitoredInboxesForBouncedCampaignEmails
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;
}
示例4: pollMonitoredInboxesForBouncedCampaignEmails
function pollMonitoredInboxesForBouncedCampaignEmails()
{
$GLOBALS['log']->info('----->Scheduler job of type pollMonitoredInboxesForBouncedCampaignEmails()');
global $dictionary;
$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();
$GLOBALS['log']->info("Bounced campaign scheduler connected to mail server id: {$a['id']} ");
$newMsgs = array();
if ($ieX->isPop3Protocol()) {
$newMsgs = $ieX->getPop3NewMessagesToDownload();
} else {
$newMsgs = $ieX->getNewMessageIds();
}
//$newMsgs = $ieX->getNewMessageIds();
if (is_array($newMsgs)) {
foreach ($newMsgs as $k => $msgNo) {
$uid = $msgNo;
if ($ieX->isPop3Protocol()) {
$uid = $ieX->getUIDLForMessage($msgNo);
} else {
$uid = imap_uid($ieX->conn, $msgNo);
}
// else
$GLOBALS['log']->info("Bounced campaign scheduler will import message no: {$msgNo}");
$ieX->importOneEmail($msgNo, $uid, false, false);
}
}
imap_expunge($ieX->conn);
imap_close($ieX->conn);
}
return true;
}
示例5: testgetNewMessageIds
public function testgetNewMessageIds()
{
$inboundEmail = new InboundEmail();
$result = $inboundEmail->getNewMessageIds();
$this->assertEquals(null, $result);
}