当前位置: 首页>>代码示例>>PHP>>正文


PHP imap_setflag_full函数代码示例

本文整理汇总了PHP中imap_setflag_full函数的典型用法代码示例。如果您正苦于以下问题:PHP imap_setflag_full函数的具体用法?PHP imap_setflag_full怎么用?PHP imap_setflag_full使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了imap_setflag_full函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: get_messages

 /**
  * Get messages according to a search criteria
  * 
  * @param	string	search criteria (RFC2060, sec. 6.4.4). Set to "UNSEEN" by default
  *					NB: Search criteria only affects IMAP mailboxes.
  * @param	string	date format. Set to "Y-m-d H:i:s" by default
  * @return	mixed	array containing messages
  */
 public function get_messages($search_criteria = "UNSEEN", $date_format = "Y-m-d H:i:s")
 {
     $msgs = imap_search($this->imap_stream, $search_criteria);
     $no_of_msgs = $msgs ? count($msgs) : 0;
     $messages = array();
     for ($i = 0; $i < $no_of_msgs; $i++) {
         // Get Message Unique ID in case mail box changes
         // in the middle of this operation
         $message_id = imap_uid($this->imap_stream, $msgs[$i]);
         $header = imap_header($this->imap_stream, $message_id);
         $date = date($date_format, $header->udate);
         $from = $header->from;
         $fromname = "";
         $fromaddress = "";
         $subject = "";
         foreach ($from as $id => $object) {
             if (isset($object->personal)) {
                 $fromname = $object->personal;
             }
             $fromaddress = $object->mailbox . "@" . $object->host;
             if ($fromname == "") {
                 // In case from object doesn't have Name
                 $fromname = $fromaddress;
             }
         }
         if (isset($header->subject)) {
             $subject = $this->_mime_decode($header->subject);
         }
         $structure = imap_fetchstructure($this->imap_stream, $message_id);
         $body = '';
         if (!empty($structure->parts)) {
             for ($j = 0, $k = count($structure->parts); $j < $k; $j++) {
                 $part = $structure->parts[$j];
                 if ($part->subtype == 'PLAIN') {
                     $body = imap_fetchbody($this->imap_stream, $message_id, $j + 1);
                 }
             }
         } else {
             $body = imap_body($this->imap_stream, $message_id);
         }
         // Convert quoted-printable strings (RFC2045)
         $body = imap_qprint($body);
         array_push($messages, array('msg_no' => $message_id, 'date' => $date, 'from' => $fromname, 'email' => $fromaddress, 'subject' => $subject, 'body' => $body));
         // Mark Message As Read
         imap_setflag_full($this->imap_stream, $message_id, "\\Seen");
     }
     return $messages;
 }
开发者ID:shukster,项目名称:Cuidemos-el-Voto,代码行数:56,代码来源:Imap.php

示例2: readMessages

function readMessages($messages)
{
    $mbox = getMbox();
    $messages = uidToSecuence($mbox, $messages);
    imap_setflag_full($mbox, $messages, '\\Seen');
    imap_close($mbox);
}
开发者ID:palako,项目名称:mobilewebmail,代码行数:7,代码来源:performaction.php

示例3: deleteMessage

 public function deleteMessage($id)
 {
     $status = imap_setflag_full($this->mailbox, $id, '\\Deleted');
     imap_expunge($this->mailbox);
     header("Location: /");
     /* Redirect browser */
     /* Make sure that code below does not get executed when we redirect. */
     return $status;
 }
开发者ID:charvoa,项目名称:Epitech-2,代码行数:9,代码来源:imapClass.php

示例4: skip_mail

function skip_mail($imap, $current_message, $note, $mail = false)
{
    // display note, and clear process lock.
    global $lang, $applicationname, $email_errors, $imap, $current_message, $email_errors_address, $email_from;
    echo $note . "\r\n";
    if ($current_message != "") {
        imap_setflag_full($imap, "{$current_message}", "\\Seen \\Flagged");
        echo "Marked message as seen. It will be omitted on the next run.\r\n\r\n";
    }
    if ($mail && $email_errors) {
        send_mail($email_errors_address, $applicationname . " - " . $lang["checkmail_mail_skipped"], $note, $email_from);
    }
    clear_process_lock("checkmail");
    die;
}
开发者ID:perryrothjohnson,项目名称:resourcespace,代码行数:15,代码来源:checkmail_functions.php

示例5: search

 /**
  * @param string $search
  */
 public static function search($search = 'UNSEEN')
 {
     $data = imap_search(self::$mbox, $search);
     $messages = array();
     if ($data !== false) {
         foreach ($data as $i) {
             $headerArr = imap_headerinfo(self::$mbox, $i);
             self::getMsg($i);
             $messages[] = array('from' => $headerArr->sender[0]->mailbox . "@" . $headerArr->sender[0]->host, 'to' => $headerArr->to[0]->mailbox . "@" . $headerArr->to[0]->host, 'date' => $headerArr->date, 'size' => $headerArr->Size, 'charset' => self::$charset, 'name' => self::decode($headerArr->sender[0]->personal), 'subject' => self::decode($headerArr->subject), 'plain' => self::$plainmsg, 'html' => self::$htmlmsg, 'attach' => self::$attachments);
             imap_setflag_full(self::$mbox, $i, "\\Seen");
         }
         self::$messages = $messages;
         unset($messages);
     }
 }
开发者ID:terrasystems,项目名称:csgobattlecom,代码行数:18,代码来源:Imap.php

示例6: purge_message

 function purge_message($mailbox, $message)
 {
     if (isset($message['imap_uid'])) {
         if ($result = $this->open_mailbox($mailbox)) {
             if ($mailbox->settings['delete_after_read']) {
                 imap_delete($result, $message['imap_uid'], FT_UID);
             } elseif (!isset($mailbox->settings['flag_after_read']) || $mailbox->settings['flag_after_read']) {
                 imap_setflag_full($result, (string) $message['imap_uid'], '\\Seen', FT_UID);
             }
             $this->close_mailbox($result);
         } else {
             drupal_set_message(t('Unable to connect to mailbox.'));
             watchdog('mailhandler', 'Unable to connect to %mail', array('%mail' => $mailbox->mail), WATCHDOG_ERROR);
         }
     }
 }
开发者ID:tierce,项目名称:ppbe,代码行数:16,代码来源:MailhandlerPhpImapRetrieve.class.php

示例7: get_messages

 /**
  * Get messages according to a search criteria
  *
  * @param	string	search criteria (RFC2060, sec. 6.4.4). Set to "UNSEEN" by default
  *					NB: Search criteria only affects IMAP mailboxes.
  * @param	string	date format. Set to "Y-m-d H:i:s" by default
  * @return	mixed	array containing messages
  */
 public function get_messages($search_criteria = "UNSEEN", $date_format = "Y-m-d H:i:s")
 {
     global $htmlmsg, $plainmsg, $attachments;
     // If our imap connection failed earlier, return no messages
     if ($this->imap_stream == false) {
         return array();
     }
     $no_of_msgs = imap_num_msg($this->imap_stream);
     $max_imap_messages = Kohana::config('email.max_imap_messages');
     // Check to see if the number of messages we want to sort through is greater than
     //   the number of messages we want to allow. If there are too many messages, it
     //   can fail and that's no good.
     $msg_to_pull = $no_of_msgs;
     //** Disabled this config setting for now - causing issues **
     //if($msg_to_pull > $max_imap_messages){
     //	$msg_to_pull = $max_imap_messages;
     //}
     $messages = array();
     for ($msgno = 1; $msgno <= $msg_to_pull; $msgno++) {
         $header = imap_headerinfo($this->imap_stream, $msgno);
         if (!isset($header->message_id) or !isset($header->udate)) {
             continue;
         }
         $message_id = $header->message_id;
         $date = date($date_format, $header->udate);
         if (isset($header->from)) {
             $from = $header->from;
         } else {
             $from = FALSE;
         }
         $fromname = "";
         $fromaddress = "";
         $subject = "";
         $body = "";
         $attachments = "";
         if ($from != FALSE) {
             foreach ($from as $id => $object) {
                 if (isset($object->personal)) {
                     $fromname = $object->personal;
                 }
                 if (isset($object->mailbox) and isset($object->host)) {
                     $fromaddress = $object->mailbox . "@" . $object->host;
                 }
                 if ($fromname == "") {
                     // In case from object doesn't have Name
                     $fromname = $fromaddress;
                 }
             }
         }
         if (isset($header->subject)) {
             $subject = $this->_mime_decode($header->subject);
         }
         // Fetch Body
         $this->_getmsg($this->imap_stream, $msgno);
         if ($htmlmsg) {
             // Convert HTML to Text
             $html2text = new Html2Text($htmlmsg);
             $htmlmsg = $html2text->get_text();
         }
         $body = $plainmsg ? $plainmsg : $htmlmsg;
         // Fetch Attachments
         $attachments = $this->_extract_attachments($this->imap_stream, $msgno);
         // Convert to valid UTF8
         $body = htmlentities($body);
         $subject = htmlentities(strip_tags($subject));
         array_push($messages, array('message_id' => $message_id, 'date' => $date, 'from' => $fromname, 'email' => $fromaddress, 'subject' => $subject, 'body' => $body, 'attachments' => $attachments));
         // Mark Message As Read
         imap_setflag_full($this->imap_stream, $msgno, "\\Seen");
     }
     return $messages;
 }
开发者ID:redspider,项目名称:Ushahidi_Web,代码行数:79,代码来源:Imap.php

示例8: _getFormattedMail

 /**
  * get the basic details like sender and reciver with flags like attatchments etc
  *
  * @param int $uid the number of the message
  * @return array empty on error/nothing or array of formatted details
  */
 protected function _getFormattedMail($Model, $uid, $fetchAttachments = false)
 {
     // Translate uid to msg_no. Has no decent fail
     $msg_number = imap_msgno($this->Stream, $uid);
     // A hack to detect if imap_msgno failed, and we're in fact looking at the wrong mail
     if ($uid != ($mailuid = imap_uid($this->Stream, $msg_number))) {
         pr(compact('Mail'));
         return $this->err($Model, 'Mail id mismatch. parameter id: %s vs mail id: %s', $uid, $mailuid);
     }
     // Get Mail with a property: 'date' or fail
     if (!($Mail = imap_headerinfo($this->Stream, $msg_number)) || !property_exists($Mail, 'date')) {
         pr(compact('Mail'));
         return $this->err($Model, 'Unable to find mail date property in Mail corresponding with uid: %s. Something must be wrong', $uid);
     }
     // Get Mail with a property: 'type' or fail
     if (!($flatStructure = $this->_flatStructure($Model, $uid))) {
         return $this->err($Model, 'Unable to find structure type property in Mail corresponding with uid: %s. Something must be wrong', $uid);
     }
     $plain = $this->_fetchFirstByMime($flatStructure, 'text/plain');
     $html = $this->_fetchFirstByMime($flatStructure, 'text/html');
     $return[$Model->alias] = array('id' => $this->_toId($uid), 'message_id' => $Mail->message_id, 'email_number' => $Mail->Msgno, 'to' => $this->_personId($Mail, 'to', 'address'), 'to_name' => $this->_personId($Mail, 'to', 'name'), 'from' => $this->_personId($Mail, 'from', 'address'), 'from_name' => $this->_personId($Mail, 'from', 'name'), 'reply_to' => $this->_personId($Mail, 'reply_to', 'address'), 'reply_to_name' => $this->_personId($Mail, 'reply_to', 'name'), 'sender' => $this->_personId($Mail, 'sender', 'address'), 'sender_name' => $this->_personId($Mail, 'sender', 'name'), 'subject' => htmlspecialchars(@$Mail->subject), 'slug' => Inflector::slug(@$Mail->subject, '-'), 'header' => @imap_fetchheader($this->Stream, $uid, FT_UID), 'body' => $html, 'plainmsg' => $plain ? $plain : $html, 'size' => @$Mail->Size, 'recent' => @$Mail->Recent === 'R' ? 1 : 0, 'seen' => @$Mail->Unseen === 'U' ? 0 : 1, 'flagged' => @$Mail->Flagged === 'F' ? 1 : 0, 'answered' => @$Mail->Answered === 'A' ? 1 : 0, 'draft' => @$Mail->Draft === 'X' ? 1 : 0, 'deleted' => @$Mail->Deleted === 'D' ? 1 : 0, 'thread_count' => $this->_getThreadCount($Mail), 'in_reply_to' => @$Mail->in_reply_to, 'reference' => @$Mail->references, 'new' => (int) @$Mail->in_reply_to, 'created' => date('Y-m-d H:i:s', strtotime($Mail->date)));
     if ($fetchAttachments) {
         $return['Attachment'] = $this->_fetchAttachments($flatStructure, $Model);
     }
     // Auto mark after read
     if (!empty($this->config['auto_mark_as'])) {
         $marks = '\\' . join(' \\', $this->config['auto_mark_as']);
         if (!imap_setflag_full($this->Stream, $uid, $marks, ST_UID)) {
             $this->err($Model, 'Unable to mark email %s as %s', $uid, $marks);
         }
     }
     return $return;
 }
开发者ID:rikdc,项目名称:cakephp-emails-plugin,代码行数:39,代码来源:imap_source.php

示例9: fetchEmails

 function fetchEmails()
 {
     if (!$this->connect()) {
         return false;
     }
     $archiveFolder = $this->getArchiveFolder();
     $delete = $this->canDeleteEmails();
     $max = $this->getMaxFetch();
     $nummsgs = imap_num_msg($this->mbox);
     //echo "New Emails:  $nummsgs\n";
     $msgs = $errors = 0;
     for ($i = $nummsgs; $i > 0; $i--) {
         //process messages in reverse.
         if ($this->createTicket($i)) {
             imap_setflag_full($this->mbox, imap_uid($this->mbox, $i), "\\Seen", ST_UID);
             //IMAP only??
             if ((!$archiveFolder || !imap_mail_move($this->mbox, $i, $archiveFolder)) && $delete) {
                 imap_delete($this->mbox, $i);
             }
             $msgs++;
             $errors = 0;
             //We are only interested in consecutive errors.
         } else {
             $errors++;
         }
         if ($max && ($msgs >= $max || $errors > $max * 0.8)) {
             break;
         }
     }
     //Warn on excessive errors
     if ($errors > $msgs) {
         $warn = sprintf(_S('Excessive errors processing emails for %1$s/%2$s. Please manually check the inbox.'), $this->getHost(), $this->getUsername());
         $this->log($warn);
     }
     @imap_expunge($this->mbox);
     return $msgs;
 }
开发者ID:KM-MFG,项目名称:osTicket-1.8,代码行数:37,代码来源:class.mailfetch.php

示例10: email_setflag

  /**
  * Set flags
  */ 
 function email_setflag(){
   
   imap_setflag_full($this->link, "2,5","\\Seen \\Flagged"); 
 
 }
开发者ID:AnarKyx01,项目名称:scorebot-vagrant,代码行数:8,代码来源:class.emailtodb.php

示例11: KLogger

<?php 
// read mails from internal bounce mailbox and set invalidEmail=1 for these email addresses
require '/var/www/yoursite/http/variables.php';
require '/var/www/yoursite/http/variablesdb.php';
require_once '/var/www/yoursite/http/functions.php';
require '/var/www/yoursite/http/log/KLogger.php';
$log = new KLogger('/var/www/yoursite/http/log/bounces/', KLogger::INFO);
$mailbox = imap_open('{localhost:993/ssl/novalidate-cert}', 'bounce', 'bounce01$');
$mailbox_info = imap_check($mailbox);
for ($i = 1; $i <= $mailbox_info->Nmsgs; $i++) {
    $msg = imap_fetch_overview($mailbox, $i);
    $rcpt = $msg[0]->to;
    if (substr($rcpt, 0, 6) == 'bounce') {
        $target = substr($rcpt, 7);
        // exclude 'bounce='
        $target = substr($target, 0, -9);
        // exclude '@yoursite'
        $target = str_replace('=', '@', $target);
        // revert '=' to '@'
        if ($msg[0]->answered == 0) {
            $sql = "UPDATE {$playerstable} SET invalidEmail=1 WHERE invalidEmail=0 AND mail='" . $target . "'";
            mysql_query($sql);
            $affected = mysql_affected_rows();
            $uid = imap_uid($mailbox, $i);
            $status = imap_setflag_full($mailbox, $uid, '\\Answered \\Seen', ST_UID);
            $log->logInfo('sql=[' . $sql . '] affected=[' . $affected . '] status=[' . $status . ']');
        }
    }
}
imap_close($mailbox);
// close the mailbox
开发者ID:kinj1987,项目名称:evo-league,代码行数:31,代码来源:bounces.php

示例12: strtolower

            $mimetype = $type[(int) $info->parts[$counter]->type] . '/' . $info->parts[$counter]->subtype;
            $mimetype = strtolower($mimetype);
            echo " - File: {$filename} ({$mimetype})... ";
            $fullfilename = 'tmp/attachments/' . $uid . '/' . $filename;
            $file = 'tmp/attachments/' . $uid . '/mail.txt';
            imap_savebody($inbox, $file, $message->msgno);
            $parser = new MimeMailParser();
            $parser->setPath($file);
            $attachments = $parser->getAttachmentsAsStreams();
            file_put_contents($fullfilename, $attachments[$counter - 1]);
            echo "done\n";
            $package->addFile($filename, $mimetype);
            $counter++;
        }
        // Deposit the package
        $package->create();
        $client = new SWORDAPPClient();
        $response = $client->deposit($swordurl, $sworduser, $swordpassword, '', 'tmp/' . $packagefilename, 'http://purl.org/net/sword-types/METSDSpaceSIP', 'application/zip', false, true);
        // print_r($response);
        $id = $response->sac_id;
        $id = str_replace("http://hdl.handle.net/", "http://dspace.swordapp.org/jspui/handle/", $id);
        echo "Deposited at " . $id . "\n\n";
        $to = $message->from;
        $from = "From: " . $mailuser;
        $subject = "Deposit successful: " . $id;
        $contents = "Thanks you for your deposit. It can be viewed at " . $id;
        mail($to, $subject, $contents, $from);
        // Mark the message as read
        imap_setflag_full($inbox, $message->msgno, "\\Seen");
    }
}
开发者ID:nimish321,项目名称:openscholar,代码行数:31,代码来源:imap-email.php

示例13: MoveMessage

 /**
  * Called when the user moves an item on the PDA from one folder to another
  *
  * @param string              $folderid            id of the source folder
  * @param string              $id                  id of the message
  * @param string              $newfolderid         id of the destination folder
  * @param ContentParameters   $contentparameters
  *
  * @access public
  * @return boolean                      status of the operation
  * @throws StatusException              could throw specific SYNC_MOVEITEMSSTATUS_* exceptions
  */
 public function MoveMessage($folderid, $id, $newfolderid, $contentparameters)
 {
     ZLog::Write(LOGLEVEL_DEBUG, sprintf("BackendIMAP->MoveMessage('%s','%s','%s')", $folderid, $id, $newfolderid));
     $folderImapid = $this->getImapIdFromFolderId($folderid);
     $newfolderImapid = $this->getImapIdFromFolderId($newfolderid);
     if ($folderImapid == $newfolderImapid) {
         throw new StatusException(sprintf("BackendIMAP->MoveMessage('%s','%s','%s'): Error, destination folder is source folder. Canceling the move.", $folderid, $id, $newfolderid), SYNC_MOVEITEMSSTATUS_SAMESOURCEANDDEST);
     }
     $this->imap_reopen_folder($folderImapid);
     if ($this->imap_inside_cutoffdate(Utils::GetCutOffDate($contentparameters->GetFilterType()), $id)) {
         // read message flags
         $overview = @imap_fetch_overview($this->mbox, $id, FT_UID);
         if (!is_array($overview)) {
             throw new StatusException(sprintf("BackendIMAP->MoveMessage('%s','%s','%s'): Error, unable to retrieve overview of source message: %s", $folderid, $id, $newfolderid, imap_last_error()), SYNC_MOVEITEMSSTATUS_INVALIDSOURCEID);
         } else {
             // get next UID for destination folder
             // when moving a message we have to announce through ActiveSync the new messageID in the
             // destination folder. This is a "guessing" mechanism as IMAP does not inform that value.
             // when lots of simultaneous operations happen in the destination folder this could fail.
             // in the worst case the moved message is displayed twice on the mobile.
             $destStatus = imap_status($this->mbox, $this->server . $newfolderImapid, SA_ALL);
             if (!$destStatus) {
                 throw new StatusException(sprintf("BackendIMAP->MoveMessage('%s','%s','%s'): Error, unable to open destination folder: %s", $folderid, $id, $newfolderid, imap_last_error()), SYNC_MOVEITEMSSTATUS_INVALIDDESTID);
             }
             $newid = $destStatus->uidnext;
             // move message
             $s1 = imap_mail_move($this->mbox, $id, $newfolderImapid, CP_UID);
             if (!$s1) {
                 throw new StatusException(sprintf("BackendIMAP->MoveMessage('%s','%s','%s'): Error, copy to destination folder failed: %s", $folderid, $id, $newfolderid, imap_last_error()), SYNC_MOVEITEMSSTATUS_CANNOTMOVE);
             }
             // delete message in from-folder
             $s2 = imap_expunge($this->mbox);
             // open new folder
             $stat = $this->imap_reopen_folder($newfolderImapid);
             if (!$stat) {
                 throw new StatusException(sprintf("BackendIMAP->MoveMessage('%s','%s','%s'): Error, opening the destination folder: %s", $folderid, $id, $newfolderid, imap_last_error()), SYNC_MOVEITEMSSTATUS_CANNOTMOVE);
             }
             // remove all flags
             $s3 = @imap_clearflag_full($this->mbox, $newid, "\\Seen \\Answered \\Flagged \\Deleted \\Draft", FT_UID);
             $newflags = "";
             $move_to_trash = strcasecmp($newfolderImapid, $this->create_name_folder(IMAP_FOLDER_TRASH)) == 0;
             if ($overview[0]->seen || $move_to_trash && defined('IMAP_AUTOSEEN_ON_DELETE') && IMAP_AUTOSEEN_ON_DELETE == true) {
                 $newflags .= "\\Seen";
             }
             if ($overview[0]->flagged) {
                 $newflags .= " \\Flagged";
             }
             if ($overview[0]->answered) {
                 $newflags .= " \\Answered";
             }
             $s4 = @imap_setflag_full($this->mbox, $newid, $newflags, FT_UID);
             ZLog::Write(LOGLEVEL_DEBUG, sprintf("BackendIMAP->MoveMessage('%s','%s','%s'): result s-move: '%s' s-expunge: '%s' unset-Flags: '%s' set-Flags: '%s'", $folderid, $id, $newfolderid, Utils::PrintAsString($s1), Utils::PrintAsString($s2), Utils::PrintAsString($s3), Utils::PrintAsString($s4)));
             // return the new id "as string"
             return $newid . "";
         }
     } else {
         throw new StatusException(sprintf("BackendIMAP->MoveMessage(): Message is outside the sync range"), SYNC_MOVEITEMSSTATUS_INVALIDSOURCEID);
     }
 }
开发者ID:peterbeck,项目名称:Z-Push-contrib,代码行数:71,代码来源:imap.php

示例14: MailBox

        $smarty->assign('SUBJECT', $focus->column_fields['subject']);
        $smarty->assign('DESCRIPTION', $focus->column_fields['description']);
    }
    $smarty->display('PrintEmail.tpl');
}
if (isset($_REQUEST['record']) && isset($_REQUEST['mailbox']) && $_REQUEST['print']) {
    if (isset($_REQUEST["mailbox"]) && $_REQUEST["mailbox"] != "") {
        $mailbox = $_REQUEST["mailbox"];
    } else {
        $mailbox = "INBOX";
    }
    $mailid = $_REQUEST['record'];
    $MailBox = new MailBox($mailbox);
    $mail = $MailBox->mbox;
    $email = new Webmails($MailBox->mbox, $mailid);
    $status = imap_setflag_full($MailBox->mbox, $mailid, "\\Seen");
    $attach_tab = array();
    $email->loadMail($attach_tab);
    echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=" . $email->charsets . "\">\n";
    //JFV - for subject garbled issue reported by ayano,
    if (function_exists("mb_decode_mimeheader") && function_exists("mb_internal_encoding") && function_exists("mb_convert_encoding")) {
        if (strtoupper(substr($email->subject, 0, 13)) == "=?ISO-2022-JP" && @mb_convert_encoding(1, 'iso-2022-jp-ms')) {
            $jfv_subject = str_ireplace('?iso-2022-jp?', '?iso-2022-jp-ms?', $email->subject);
        } elseif (strtoupper(substr($email->subject, 0, 11)) == "=?SHIFT_JIS" && @mb_convert_encoding(1, 'SJIS-win')) {
            $jfv_subject = str_ireplace('?shift_jis?', '?SJIS-win?', $email->subject);
        } elseif (strtoupper(substr($email->subject, 0, 8)) == "=?EUC-JP" && @mb_convert_encoding(1, 'eucJP-win')) {
            $jfv_subject = str_ireplace('?euc-jp?', '?eucJP-win?', $email->subject);
        } else {
            $jfv_subject = $email->subject;
        }
        $jfv_default_internal_enc = mb_internal_encoding();
开发者ID:hbsman,项目名称:vtigercrm-5.3.0-ja,代码行数:31,代码来源:PrintEmail.php

示例15: MoveMessage

 /**
  * Called when the user moves an item on the PDA from one folder to another
  *
  * @param string              $folderid            id of the source folder
  * @param string              $id                  id of the message
  * @param string              $newfolderid         id of the destination folder
  * @param ContentParameters   $contentparameters
  *
  * @access public
  * @return boolean                      status of the operation
  * @throws StatusException              could throw specific SYNC_MOVEITEMSSTATUS_* exceptions
  */
 public function MoveMessage($folderid, $id, $newfolderid, $contentparameters)
 {
     ZLog::Write(LOGLEVEL_DEBUG, sprintf("BackendIMAP->MoveMessage('%s','%s','%s')", $folderid, $id, $newfolderid));
     $folderImapid = $this->getImapIdFromFolderId($folderid);
     // SDB: When iOS is configured to "Archive Message" (instead of Delete Message), it will send a "MoveItems"
     // command to the Exchange server and attempt to move it to a folder called "0/Archive". Instead, we trap that
     // and send it to "[Gmail]/All Mail" folder instead. Note, that when on iOS device and you trigger a move from
     // folder A to B, it will correctly move that email, including to all folders with "[Gmail]...".
     if ($newfolderid == "0/Archive") {
         $newfolderImapid = "[Gmail]/All Mail";
     } else {
         $newfolderImapid = $this->getImapIdFromFolderId($newfolderid);
     }
     if ($folderImapid == $newfolderImapid) {
         throw new StatusException(sprintf("BackendIMAP->MoveMessage('%s','%s','%s'): Error, destination folder is source folder. Canceling the move.", $folderid, $id, $newfolderid), SYNC_MOVEITEMSSTATUS_SAMESOURCEANDDEST);
     }
     $this->imap_reopen_folder($folderImapid);
     if ($this->imap_inside_cutoffdate(Utils::GetCutOffDate($contentparameters->GetFilterType()), $id)) {
         // read message flags
         $overview = @imap_fetch_overview($this->mbox, $id, FT_UID);
         if (!is_array($overview)) {
             throw new StatusException(sprintf("BackendIMAP->MoveMessage('%s','%s','%s'): Error, unable to retrieve overview of source message: %s", $folderid, $id, $newfolderid, imap_last_error()), SYNC_MOVEITEMSSTATUS_INVALIDSOURCEID);
         } else {
             // get next UID for destination folder
             // when moving a message we have to announce through ActiveSync the new messageID in the
             // destination folder. This is a "guessing" mechanism as IMAP does not inform that value.
             // when lots of simultaneous operations happen in the destination folder this could fail.
             // in the worst case the moved message is displayed twice on the mobile.
             $destStatus = imap_status($this->mbox, $this->server . $newfolderImapid, SA_ALL);
             if (!$destStatus) {
                 throw new StatusException(sprintf("BackendIMAP->MoveMessage('%s','%s','%s'): Error, unable to open destination folder: %s", $folderid, $id, $newfolderid, imap_last_error()), SYNC_MOVEITEMSSTATUS_INVALIDDESTID);
             }
             $newid = $destStatus->uidnext;
             // move message
             $s1 = imap_mail_move($this->mbox, $id, $newfolderImapid, CP_UID);
             if (!$s1) {
                 throw new StatusException(sprintf("BackendIMAP->MoveMessage('%s','%s','%s'): Error, copy to destination folder failed: %s", $folderid, $id, $newfolderid, imap_last_error()), SYNC_MOVEITEMSSTATUS_CANNOTMOVE);
             }
             // delete message in from-folder
             $s2 = imap_expunge($this->mbox);
             // open new folder
             $stat = $this->imap_reopen_folder($newfolderImapid);
             if (!$s1) {
                 throw new StatusException(sprintf("BackendIMAP->MoveMessage('%s','%s','%s'): Error, opening the destination folder: %s", $folderid, $id, $newfolderid, imap_last_error()), SYNC_MOVEITEMSSTATUS_CANNOTMOVE);
             }
             // remove all flags
             $s3 = @imap_clearflag_full($this->mbox, $newid, "\\Seen \\Answered \\Flagged \\Deleted \\Draft", FT_UID);
             $newflags = "";
             if ($overview[0]->seen) {
                 $newflags .= "\\Seen";
             }
             if ($overview[0]->flagged) {
                 $newflags .= " \\Flagged";
             }
             if ($overview[0]->answered) {
                 $newflags .= " \\Answered";
             }
             $s4 = @imap_setflag_full($this->mbox, $newid, $newflags, FT_UID);
             ZLog::Write(LOGLEVEL_DEBUG, sprintf("BackendIMAP->MoveMessage('%s','%s','%s'): result s-move: '%s' s-expunge: '%s' unset-Flags: '%s' set-Flags: '%s'", $folderid, $id, $newfolderid, Utils::PrintAsString($s1), Utils::PrintAsString($s2), Utils::PrintAsString($s3), Utils::PrintAsString($s4)));
             // return the new id "as string"
             return $newid . "";
         }
     } else {
         throw new StatusException(sprintf("BackendIMAP->MoveMessage(): Message is outside the sync range"), SYNC_MOVEITEMSSTATUS_INVALIDSOURCEID);
     }
 }
开发者ID:alanturing1,项目名称:Z-Push-contrib,代码行数:78,代码来源:imap.php


注:本文中的imap_setflag_full函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。