本文整理匯總了PHP中InboundEmail::retrieve方法的典型用法代碼示例。如果您正苦於以下問題:PHP InboundEmail::retrieve方法的具體用法?PHP InboundEmail::retrieve怎麽用?PHP InboundEmail::retrieve使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類InboundEmail
的用法示例。
在下文中一共展示了InboundEmail::retrieve方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: SugarPHPMailer
/**
* Sends Email for Email 2.0
*/
function email2Send($request)
{
global $mod_strings;
global $app_strings;
global $current_user;
global $sugar_config;
global $locale;
global $timedate;
global $beanList;
global $beanFiles;
$OBCharset = $locale->getPrecedentPreference('default_email_charset');
/**********************************************************************
* Sugar Email PREP
*/
/* preset GUID */
$orignialId = "";
if (!empty($this->id)) {
$orignialId = $this->id;
}
// if
if (empty($this->id)) {
$this->id = create_guid();
$this->new_with_id = true;
}
/* satisfy basic HTML email requirements */
$this->name = $request['sendSubject'];
$this->description_html = '<html><body>' . $request['sendDescription'] . '</body></html>';
/**********************************************************************
* PHPMAILER PREP
*/
$mail = new SugarPHPMailer();
$mail = $this->setMailer($mail, '', $_REQUEST['fromAccount']);
if (empty($mail->Host) && !$this->isDraftEmail($request)) {
$this->status = 'send_error';
if ($mail->oe->type == 'system') {
echo $app_strings['LBL_EMAIL_ERROR_PREPEND'] . $app_strings['LBL_EMAIL_INVALID_SYSTEM_OUTBOUND'];
} else {
echo $app_strings['LBL_EMAIL_ERROR_PREPEND'] . $app_strings['LBL_EMAIL_INVALID_PERSONAL_OUTBOUND'];
}
return false;
}
$subject = $this->name;
$mail->Subject = from_html($this->name);
// work-around legacy code in SugarPHPMailer
if ($_REQUEST['setEditor'] == 1) {
$_REQUEST['description_html'] = $_REQUEST['sendDescription'];
$this->description_html = $_REQUEST['description_html'];
} else {
$this->description_html = '';
$this->description = $_REQUEST['sendDescription'];
}
// end work-around
if ($this->isDraftEmail($request)) {
if ($this->type != 'draft' && $this->status != 'draft') {
$this->id = create_guid();
$this->new_with_id = true;
$this->date_entered = "";
}
// if
$q1 = "update emails_email_addr_rel set deleted = 1 WHERE email_id = '{$this->id}'";
$r1 = $this->db->query($q1);
}
// if
if (isset($request['saveDraft'])) {
$this->type = 'draft';
$this->status = 'draft';
$forceSave = true;
} else {
/* Apply Email Templates */
// do not parse email templates if the email is being saved as draft....
$toAddresses = $this->email2ParseAddresses($_REQUEST['sendTo']);
$sea = new SugarEmailAddress();
$object_arr = array();
if (isset($_REQUEST['parent_type']) && !empty($_REQUEST['parent_type']) && isset($_REQUEST['parent_id']) && !empty($_REQUEST['parent_id']) && ($_REQUEST['parent_type'] == 'Accounts' || $_REQUEST['parent_type'] == 'Contacts' || $_REQUEST['parent_type'] == 'Leads' || $_REQUEST['parent_type'] == 'Users' || $_REQUEST['parent_type'] == 'Prospects')) {
if (isset($beanList[$_REQUEST['parent_type']]) && !empty($beanList[$_REQUEST['parent_type']])) {
$className = $beanList[$_REQUEST['parent_type']];
if (isset($beanFiles[$className]) && !empty($beanFiles[$className])) {
if (!class_exists($className)) {
require_once $beanFiles[$className];
}
$bean = new $className();
$bean->retrieve($_REQUEST['parent_id']);
$object_arr[$bean->module_dir] = $bean->id;
}
// if
}
// if
}
foreach ($toAddresses as $addrMeta) {
$addr = $addrMeta['email'];
$beans = $sea->getBeansByEmailAddress($addr);
foreach ($beans as $bean) {
if (!isset($object_arr[$bean->module_dir])) {
$object_arr[$bean->module_dir] = $bean->id;
}
}
}
//.........這裏部分代碼省略.........
示例2: retrieveAllByGroupIdWithGroupAccounts
/**
* Retrieves an array of I-E beans that the user has team access to including group
*/
function retrieveAllByGroupIdWithGroupAccounts($id, $includePersonal = true)
{
global $current_user;
$beans = $includePersonal ? $this->retrieveByGroupId($id) : array();
$teamJoin = '';
$q = "SELECT DISTINCT inbound_email.id FROM inbound_email {$teamJoin} WHERE is_personal = 0 AND mailbox_type not like 'bounce' AND status = 'Active' AND inbound_email.deleted = 0 ";
$r = $this->db->query($q, true);
while ($a = $this->db->fetchByAssoc($r)) {
$found = false;
foreach ($beans as $bean) {
if ($bean->id == $a['id']) {
$found = true;
}
}
if (!$found) {
$ie = new InboundEmail();
$ie->retrieve($a['id']);
$beans[$a['id']] = $ie;
}
}
return $beans;
}
示例3: get_module_title
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
require_once 'include/DetailView/DetailView.php';
require_once 'include/SugarFolders/SugarFolders.php';
global $mod_strings;
global $app_strings;
global $sugar_config;
global $timedate;
global $theme;
/* start standard DetailView layout process */
$GLOBALS['log']->info("InboundEmails DetailView");
$focus = new InboundEmail();
$focus->retrieve($_REQUEST['record']);
if (empty($focus->id)) {
sugar_die($app_strings['ERROR_NO_RECORD']);
}
// if
$focus->checkImap();
$detailView = new DetailView();
$offset = 0;
echo get_module_title($mod_strings['LBL_MODULE_TITLE'], $mod_strings['LBL_MODULE_NAME'] . ": " . $focus->name, true);
/* end standard DetailView layout process */
$exServ = explode('::', $focus->service);
if ($focus->delete_seen == 1) {
$delete_seen = $mod_strings['LBL_MARK_READ_NO'];
} else {
$delete_seen = $mod_strings['LBL_MARK_READ_YES'];
}
示例4: header
$bean->importOneEmail($msgNo, $uid);
}
}
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();
$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);
示例5: getListEmails
/**
* Returns the HTML for a list of emails in a given folder
* @param GUID $ieId GUID to InboundEmail instance
* @param string $mbox Mailbox path name in dot notation
* @param int $folderListCacheOffset Seconds for valid cache file
* @return string HTML render of list.
*/
function getListEmails($ieId, $mbox, $folderListCacheOffset, $forceRefresh = 'false')
{
global $sugar_config;
$ie = new InboundEmail();
$ie->retrieve($ieId);
$list = $ie->displayFolderContents($mbox, $forceRefresh);
return $list;
}
示例6: pollMonitoredInboxesForBouncedCampaignEmails
function pollMonitoredInboxesForBouncedCampaignEmails()
{
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();
$ieX->importMessages();
}
return true;
}
示例7: InboundEmail
$searchField = !empty($_REQUEST['searchField']) ? $_REQUEST['searchField'] : "";
$multipleString = "multiple=\"true\"";
if (!empty($searchField)) {
$subdcriptionFolderHelp = "";
$multipleString = "";
if ($searchField == 'trash') {
$title = $mod_strings['LBL_SELECT_TRASH_FOLDERS'];
} else {
$title = $mod_strings['LBL_SELECT_SENT_FOLDERS'];
}
// else
}
// else
$ie = new InboundEmail();
if (!empty($_REQUEST['ie_id'])) {
$ie->retrieve($_REQUEST['ie_id']);
}
$ie->email_user = $_REQUEST['email_user'];
$ie->server_url = $_REQUEST['server_url'];
$ie->port = $_REQUEST['port'];
$ie->protocol = $_REQUEST['protocol'];
//Bug 23083.Special characters in email password results in IMAP authentication failure
if (!empty($_REQUEST['email_password'])) {
$ie->email_password = html_entity_decode($_REQUEST['email_password'], ENT_QUOTES);
$ie->email_password = str_rot13($ie->email_password);
}
//$ie->mailbox = $_REQUEST['mailbox'];
$ie->mailbox = 'INBOX';
if ($popupBoolean) {
$returnArray = $ie->getFoldersListForMailBox();
$foldersList = $returnArray['foldersList'];
示例8: 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;
}
示例9: 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;
}
示例10: InboundEmail
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo and "Supercharged by SuiteCRM" logo. If the display of the logos is not
* reasonably feasible for technical reasons, the Appropriate Legal Notices must
* display the words "Powered by SugarCRM" and "Supercharged by SuiteCRM".
********************************************************************************/
require_once 'include/SugarFolders/SugarFolders.php';
global $current_user;
$focus = new InboundEmail();
if (!empty($_REQUEST['record'])) {
$focus->retrieve($_REQUEST['record']);
} elseif (!empty($_REQUEST['origin_id'])) {
$focus->retrieve($_REQUEST['origin_id']);
unset($focus->id);
unset($focus->groupfolder_id);
}
foreach ($focus->column_fields as $field) {
if ($field == 'email_password' && empty($_REQUEST['email_password']) && !empty($_REQUEST['email_user'])) {
continue;
}
if (isset($_REQUEST[$field])) {
if ($field != "group_id") {
$focus->{$field} = trim($_REQUEST[$field]);
}
}
}
示例11: InboundEmail
/**
* Delete this inbound account.
*
*/
function _tearDownInboundAccount($inbound_account_id)
{
$focus = new InboundEmail();
$focus->retrieve($inbound_account_id);
$focus->mark_deleted($inbound_account_id);
$focus->db->query("delete from inbound_email WHERE id = '{$inbound_account_id}'");
}
示例12: pollMonitoredInboxesCustomAOP
function pollMonitoredInboxesCustomAOP()
{
$_bck_up = array('team_id' => $GLOBALS['current_user']->team_id, 'team_set_id' => $GLOBALS['current_user']->team_set_id);
$GLOBALS['log']->info('----->Scheduler fired job of type pollMonitoredInboxesCustomAOP()');
global $dictionary;
global $app_strings;
global $sugar_config;
require_once 'modules/Configurator/Configurator.php';
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\'');
$GLOBALS['log']->debug('Just got Result from get all Inbounds of Inbound Emails');
while ($a = $ie->db->fetchByAssoc($r)) {
$GLOBALS['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
$GLOBALS['log']->debug('Trying to connect to mailserver for [ ' . $a['name'] . ' ]');
if ($connectToMailServer) {
$GLOBALS['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 = getDistributionMethod($ieX);
if ($distributionMethod == 'singleUser') {
$distributionUserId = $sugar_config['aop']['distribution_user_id'];
} elseif ($distributionMethod != 'roundRobin') {
$counts = $emailUI->getAssignedEmailsCountForUsers($users);
} else {
$lastRobin = $emailUI->getLastRobin($ieX);
}
$GLOBALS['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 == 'singleUser') {
$userId = $distributionUserId;
} elseif ($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];
//.........這裏部分代碼省略.........
示例13: markEmails
/**
* Marks emails with the passed flag type. This will be applied to local
* cache files as well as remote emails.
* @param string $type Flag type
* @param string $ieId
* @param string $folder IMAP folder structure or SugarFolder GUID
* @param string $uids Comma sep list of UIDs or GUIDs
*/
function markEmails($type, $ieId, $folder, $uids)
{
global $app_strings;
$uids = $this->_cleanUIDList($uids);
$exUids = explode($app_strings['LBL_EMAIL_DELIMITER'], $uids);
if (strpos($folder, 'sugar::') !== false) {
// Collect message IDs for deleting mails from server
$messageUIDs = array();
// dealing with a sugar email object, uids are GUIDs
foreach ($exUids as $id) {
$email = BeanFactory::getBean('Emails', $id);
// BUG FIX BEGIN
// Bug 50973 - marking unread in group inbox removes message
if (empty($email->assigned_user_id)) {
$email->setFieldNullable('assigned_user_id');
}
// BUG FIX END
switch ($type) {
case "unread":
$email->status = 'unread';
$email->save();
break;
case "read":
$email->status = 'read';
$email->save();
break;
case "deleted":
if (!empty($email->message_uid)) {
$messageUIDs[] = $email->message_uid;
}
$email->delete();
break;
case "flagged":
$email->flagged = 1;
$email->save();
break;
case "unflagged":
$email->flagged = 0;
$email->save();
break;
}
// BUG FIX BEGIN
// Bug 50973 - reset assigned_user_id field defs
if (empty($email->assigned_user_id)) {
$email->revertFieldNullable('assigned_user_id');
}
// BUG FIX END
}
// Do only Mail server call, since we have an array of UIDs
switch ($type) {
case "deleted":
$ieX = new InboundEmail();
$ieX->retrieve_by_string_fields(array('groupfolder_id' => $ieId, 'deleted' => 0));
if (!empty($ieX->id) && !$ieX->is_personal) {
// function retrieve_by_string_fields doesn't decrypt email_password -> call retrieve to do it
$ieX->retrieve($ieX->id);
$ieX->deleteMessageOnMailServer(implode($app_strings['LBL_EMAIL_DELIMITER'], $messageUIDs));
}
break;
default:
break;
}
} else {
/* dealing with IMAP email, uids are IMAP uids */
global $ie;
// provided by EmailUIAjax.php
if (empty($ie)) {
$ie = BeanFactory::getBean('InboundEmail');
$ie->disable_row_level_security = true;
}
$ie->retrieve($ieId);
$ie->mailbox = $folder;
$ie->connectMailserver();
// mark cache files
if ($type == 'deleted') {
$ie->deleteMessageOnMailServer($uids);
$ie->deleteMessageFromCache($uids);
} else {
$overviews = $ie->getCacheValueForUIDs($ie->mailbox, $exUids);
$manipulated = array();
foreach ($overviews['retArr'] as $k => $overview) {
if (in_array($overview->uid, $exUids)) {
switch ($type) {
case "unread":
$overview->seen = 0;
break;
case "read":
$overview->seen = 1;
break;
case "flagged":
$overview->flagged = 1;
break;
//.........這裏部分代碼省略.........
示例14: retrieveByGroupId
/**
* retrieves an array of I-E beans based on the group_id
* @param string $groupId GUID of the group user or Individual
* @return array $beans array of beans
* @return boolean false if none returned
*/
function retrieveByGroupId($groupId)
{
$q = 'SELECT id FROM inbound_email WHERE group_id = \'' . $groupId . '\' AND deleted = 0 AND status = \'Active\'';
$r = $this->db->query($q);
$beans = array();
while ($a = $this->db->fetchByAssoc($r)) {
$ie = new InboundEmail();
$ie->retrieve($a['id']);
$beans[] = $ie;
}
return $beans;
}
示例15: getUserNameFromGroupId
public function getUserNameFromGroupId($id)
{
$inboundEmail = new InboundEmail();
//test with a invalid group_id
$inboundEmail->group_id = 2;
$result = $inboundEmail->getUserNameFromGroupId();
$this->assertEquals('', $result);
//test with a valid group_id
$inboundEmail->retrieve($id);
$result = $inboundEmail->getUserNameFromGroupId();
$this->assertEquals('admin', $result);
}