本文整理匯總了PHP中InboundEmail::markEmails方法的典型用法代碼示例。如果您正苦於以下問題:PHP InboundEmail::markEmails方法的具體用法?PHP InboundEmail::markEmails怎麽用?PHP InboundEmail::markEmails使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類InboundEmail
的用法示例。
在下文中一共展示了InboundEmail::markEmails方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: 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) {
// dealing with a sugar email object, uids are GUIDs
foreach ($exUids as $id) {
$email = new Email();
$email->retrieve($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":
$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
}
} else {
/* dealing with IMAP email, uids are IMAP uids */
global $ie;
// provided by EmailUIAjax.php
if (empty($ie)) {
$ie = new InboundEmail();
}
$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;
case "unflagged":
$overview->flagged = 0;
break;
}
$manipulated[] = $overview;
}
}
if (!empty($manipulated)) {
$ie->setCacheValue($ie->mailbox, array(), $manipulated);
/* now mark emails on email server */
$ie->markEmails(implode(",", explode($app_strings['LBL_EMAIL_DELIMITER'], $uids)), $type);
}
}
// end not type == deleted
}
}
示例2: SugarPHPMailer
//.........這裏部分代碼省略.........
}
/**********************************************************************
* SEND EMAIL (finally!)
*/
$mailSent = false;
if ($this->type != 'draft') {
$mail->prepForOutbound();
$mail->Body = $this->decodeDuringSend($mail->Body);
$mail->AltBody = $this->decodeDuringSend($mail->AltBody);
if (!$mail->Send()) {
$this->status = 'send_error';
ob_clean();
echo $app_strings['LBL_EMAIL_ERROR_PREPEND'] . $mail->ErrorInfo;
return false;
}
}
if (!(empty($orignialId) || isset($request['saveDraft']) || $this->type == 'draft' && $this->status == 'draft') && ($_REQUEST['composeType'] == 'reply' || $_REQUEST['composeType'] == 'replyAll' || $_REQUEST['composeType'] == 'replyCase') && $orignialId != $this->id) {
$originalEmail = new Email();
$originalEmail->retrieve($orignialId);
$originalEmail->reply_to_status = 1;
$originalEmail->save();
$this->reply_to_status = 0;
}
// if
if ($_REQUEST['composeType'] == 'reply' || $_REQUEST['composeType'] == 'replyCase') {
if (isset($_REQUEST['ieId']) && isset($_REQUEST['mbox'])) {
$emailFromIe = new InboundEmail();
$emailFromIe->retrieve($_REQUEST['ieId']);
$emailFromIe->mailbox = $_REQUEST['mbox'];
if (isset($emailFromIe->id) && $emailFromIe->is_personal) {
if ($emailFromIe->isPop3Protocol()) {
$emailFromIe->mark_answered($this->uid, 'pop3');
} elseif ($emailFromIe->connectMailserver() == 'true') {
$emailFromIe->markEmails($this->uid, 'answered');
$emailFromIe->mark_answered($this->uid);
}
}
}
}
if ($forceSave || $this->type == 'draft' || isset($request['saveToSugar']) && $request['saveToSugar'] == 1) {
// saving a draft OR saving a sent email
$decodedFromName = mb_decode_mimeheader($mail->FromName);
$this->from_addr = "{$decodedFromName} <{$mail->From}>";
$this->from_addr_name = $this->from_addr;
$this->to_addrs = $_REQUEST['sendTo'];
$this->to_addrs_names = $_REQUEST['sendTo'];
$this->cc_addrs = $_REQUEST['sendCc'];
$this->cc_addrs_names = $_REQUEST['sendCc'];
$this->bcc_addrs = $_REQUEST['sendBcc'];
$this->bcc_addrs_names = $_REQUEST['sendBcc'];
$this->assigned_user_id = $current_user->id;
$this->date_sent = $timedate->now();
///////////////////////////////////////////////////////////////////
//// LINK EMAIL TO SUGARBEANS BASED ON EMAIL ADDY
if (isset($_REQUEST['parent_type']) && !empty($_REQUEST['parent_type']) && isset($_REQUEST['parent_id']) && !empty($_REQUEST['parent_id'])) {
$this->parent_id = $_REQUEST['parent_id'];
$this->parent_type = $_REQUEST['parent_type'];
$q = "SELECT count(*) c FROM emails_beans WHERE email_id = '{$this->id}' AND bean_id = '{$_REQUEST['parent_id']}' AND bean_module = '{$_REQUEST['parent_type']}'";
$r = $this->db->query($q);
$a = $this->db->fetchByAssoc($r);
if ($a['c'] <= 0) {
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];
示例3: testmarkEmails
public function testmarkEmails()
{
$inboundEmail = new InboundEmail();
//execute the method and test if it works and does not throws an exception.
try {
$inboundEmail->markEmails('1', 'unread');
$inboundEmail->markEmails('1', 'read');
$inboundEmail->markEmails('1', 'flagged');
$inboundEmail->markEmails('1', 'unflagged');
$inboundEmail->markEmails('1', 'answered');
$this->assertTrue(true);
} catch (Exception $e) {
$this->fail();
}
}