本文整理匯總了PHP中InboundEmail::importOneEmail方法的典型用法代碼示例。如果您正苦於以下問題:PHP InboundEmail::importOneEmail方法的具體用法?PHP InboundEmail::importOneEmail怎麽用?PHP InboundEmail::importOneEmail使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類InboundEmail
的用法示例。
在下文中一共展示了InboundEmail::importOneEmail方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: while
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);
}
header('Location: index.php?module=Emails&action=ListViewGroup');
} else {
// fail gracefully
header('Location: index.php?module=Emails&action=index');
}
示例2: doAssignment
function doAssignment($distributeMethod, $ieid, $folder, $uids, $users)
{
global $app_strings;
$users = explode(",", $users);
$emailIds = explode($app_strings['LBL_EMAIL_DELIMITER'], $uids);
$out = "";
if ($folder != 'sugar::Emails') {
$emailIds = array();
$uids = explode($app_strings['LBL_EMAIL_DELIMITER'], $uids);
$ie = new InboundEmail();
$ie->retrieve($ieid);
$messageIndex = 1;
// dealing with an inbound email data so we need to import an email and then
foreach ($uids as $uid) {
$ie->mailbox = $folder;
$ie->connectMailserver();
$msgNo = $uid;
if (!$ie->isPop3Protocol()) {
$msgNo = imap_msgno($ie->conn, $uid);
} else {
$msgNo = $ie->getCorrectMessageNoForPop3($uid);
}
if (!empty($msgNo)) {
if ($ie->importOneEmail($msgNo, $uid)) {
$emailIds[] = $ie->email->id;
$ie->deleteMessageOnMailServer($uid);
//$ie->retrieve($ieid);
//$ie->connectMailserver();
$ie->mailbox = $folder;
$ie->deleteMessageFromCache($uids[] = $uid);
} else {
$out = $out . "Message No : " . $messageIndex . " failed. Reason : Message already imported \r\n";
}
}
$messageIndex++;
}
// for
}
// if
if (count($emailIds) > 0) {
$this->doDistributionWithMethod($users, $emailIds, $distributeMethod);
}
// if
return $out;
}
示例3: 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;
}
示例4: 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;
}
示例5: header
$bean->importOneEmail($msgNo);
}
}
imap_expunge($bean->conn);
imap_close($bean->conn);
}
}
}
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();
if (is_array($newMsgs)) {
foreach ($newMsgs as $k => $msgNo) {
$ieX->importOneEmail($msgNo);
}
}
imap_expunge($ieX->conn);
imap_close($ieX->conn);
}
header('Location: index.php?module=Emails&action=ListViewGroup');
} else {
// fail gracefully
header('Location: index.php?module=Emails&action=index');
}
示例6: testimportOneEmail
public function testimportOneEmail()
{
$inboundEmail = new InboundEmail();
$inboundEmail->mailbox = 'INBOX';
$inboundEmail->id = 1;
//execute the method and test if it works and does not throws an exception.
try {
$result = $inboundEmail->importOneEmail('1', '1');
$this->assertEquals(false, $result);
} catch (Exception $e) {
$this->fail();
}
}