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


PHP imap_msgno函数代码示例

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


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

示例1: fetch

	/**
	 * Recupera o conteúdo de uma mensagem
	 * @param	MailContext $context Contexto da conexão
	 * @param	Message $message
	 * @return	Message A própria mensagem
	 * @throws	MailStateException Caso o estado do objeto não implemente abertura
	 * @throws	MailException Caso não seja possível recuperar o conteúdo da mensagem
	 */
	public function fetch( MailContext $context , Message $message ) {
		$msgNum = imap_msgno( ImapState::$resource , $message->getUID() );

		$structure = imap_fetchstructure( ImapState::$resource , $msgNum );
		$overview = (array) current( imap_fetch_overview( ImapState::$resource , $msgNum ) );

		$message->setHeaders( imap_fetchheader( ImapState::$resource , $msgNum ) );
		$message->setOverview( $overview );

		if ( isset( $structure->parts ) && count( $structure->parts ) ) {
			foreach ( $structure->parts as $key => $part ) {
				$this->fetchContent( $message , $part->subtype , $msgNum , $key + 1 );
			}
		} else {
			$this->fetchContent( $message , $structure->subtype , $msgNum , 1 );
		}
	}
开发者ID:netojoaobatista,项目名称:phpmail,代码行数:25,代码来源:ImapOpenedState.php

示例2: setStructureFromMail

 /**
  * Open mail from Imap and parse structure
  * @license   http://www.gnu.org/copyleft/gpl.html GPL
  * @author    Consórcio Expresso Livre - 4Linux (www.4linux.com.br) e Prognus Software Livre (www.prognus.com.br)
  * @return string  menssagem
  */
 public function setStructureFromMail($folder, $msgNumber)
 {
     $this->folder = mb_convert_encoding($folder, 'UTF7-IMAP', mb_detect_encoding($folder . 'x', 'UTF-8, ISO-8859-1'));
     $this->msgNumber = $msgNumber;
     $this->username = $_SESSION['phpgw_info']['expressomail']['user']['userid'];
     $this->password = $_SESSION['phpgw_info']['expressomail']['user']['passwd'];
     $this->imap_server = $_SESSION['phpgw_info']['expressomail']['email_server']['imapServer'];
     $this->imap_port = $_SESSION['phpgw_info']['expressomail']['email_server']['imapPort'];
     $this->imap_delimiter = $_SESSION['phpgw_info']['expressomail']['email_server']['imapDelimiter'];
     $this->imap_sentfolder = $_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultSentFolder'] ? $_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultSentFolder'] : str_replace("*", "", $this->functions->getLang("Sent"));
     $this->has_cid = false;
     if ($_SESSION['phpgw_info']['expressomail']['email_server']['imapTLSEncryption'] == 'yes') {
         $this->imap_options = '/tls/novalidate-cert';
     } else {
         $this->imap_options = '/notls/novalidate-cert';
     }
     $this->mbox = @imap_open("{" . $this->imap_server . ":" . $this->imap_port . $this->imap_options . "}" . $this->folder, $this->username, $this->password) or die('Error');
     $header = @imap_headerinfo($this->mbox, imap_msgno($this->mbox, $this->msgNumber), 80, 255);
     $this->messageId = $header->message_id;
     $rawMessageData = $this->_getRaw();
     $decoder = new Mail_mimeDecode($rawMessageData);
     $this->structure = $decoder->decode($this->decodeConf);
     //TODO: Descartar código após atualização do módulo de segurança da SERPRO
     if ($this->isSignedMenssage()) {
         $this->convertSignedMenssage($rawMessageData);
     }
     //////////////////////////////////////////////////////
     /*
      * Clean memory and close imap connection
      */
     $rawMessageData = null;
     $decoder = null;
     @imap_close($this->mbox);
     //-----------------------------------------//
 }
开发者ID:cjvaz,项目名称:expressomail,代码行数:41,代码来源:class.attachment.inc.php

示例3: getAllMessages

 public function getAllMessages($imap, $dsn)
 {
     $status = imap_status($imap, $dsn, SA_ALL);
     $msgs = imap_sort($imap, SORTDATE, 1, SE_UID);
     foreach ($msgs as $msguid) {
         $msgno = imap_msgno($imap, $msguid);
         $messages[$msgno] = imap_headerinfo($imap, $msgno);
     }
     return $messages;
 }
开发者ID:maniargaurav,项目名称:OpenDesk,代码行数:10,代码来源:mail.php

示例4: header

 function header($stream, $msg_nr, $fromlength = 0, $tolength = 0, $defaulthost = '')
 {
     // do we need to temporarily switch to regular msg num sequence for this function?
     if ($this->force_msg_uids == True) {
         // this function can nothandle UIDs, switch to sequence number
         $new_msg_nr = imap_msgno($stream, $msg_nr);
         if ($new_msg_nr) {
             $msg_nr = $new_msg_nr;
         }
     }
     return imap_header($stream, $msg_nr, $fromlength, $tolength, $defaulthost);
 }
开发者ID:HaakonME,项目名称:porticoestate,代码行数:12,代码来源:class.mail_dcom_imap.inc.php

示例5: imap_get_url

function imap_get_url($u)
{
    if (!($c = imap_open_url($u))) {
        return FALSE;
    }
    extract(parse_url($u));
    extract(imap_parse_path($path));
    if ($mailbox) {
        if ($uid) {
            $msgno = imap_msgno($c, $uid);
            $o = imap_fetchstructure($c, $msgno);
        } else {
            $o = array();
            $n = imap_num_msg($c);
            while ($i++ < $n) {
                $o[] = imap_fetchheader($c, $i);
            }
        }
    } else {
        $o = imap_list($c, '{}', '*');
    }
    return $o;
}
开发者ID:nbtscommunity,项目名称:phpfnlib,代码行数:23,代码来源:imap.php

示例6: imap_msgno

             $status = $ie->importOneEmail($ie->getCorrectMessageNoForPop3($msgNo), $uid);
         }
         // else
         $return[] = $app_strings['LBL_EMAIL_MESSAGE_NO'] . " " . $count . ", " . $app_strings['LBL_STATUS'] . " " . ($status ? $app_strings['LBL_EMAIL_IMPORT_SUCCESS'] : $app_strings['LBL_EMAIL_IMPORT_FAIL']);
         $count++;
         if ($_REQUEST['delete'] == 'true' && $status && ($current_user->is_admin == 1 || $ie->group_id == $current_user->id)) {
             $ie->deleteMessageOnMailServer($uid);
             $ie->deleteMessageFromCache($uid);
         }
         // if
     }
     // for
 } else {
     $msgNo = $_REQUEST['uid'];
     if ($ie->protocol == 'imap') {
         $msgNo = imap_msgno($ie->conn, $_REQUEST['uid']);
         $status = $ie->importOneEmail($msgNo, $_REQUEST['uid']);
     } else {
         $status = $ie->importOneEmail($ie->getCorrectMessageNoForPop3($msgNo), $_REQUEST['uid']);
     }
     // else
     $return[] = $app_strings['LBL_EMAIL_MESSAGE_NO'] . " " . $count . ", " . $app_strings['LBL_STATUS'] . " " . ($status ? $app_strings['LBL_EMAIL_IMPORT_SUCCESS'] : $app_strings['LBL_EMAIL_IMPORT_FAIL']);
     if ($_REQUEST['delete'] == 'true' && $status && ($current_user->is_admin == 1 || $ie->group_id == $current_user->id)) {
         $ie->deleteMessageOnMailServer($_REQUEST['uid']);
         $ie->deleteMessageFromCache($_REQUEST['uid']);
     }
     // if
 }
 // else
 echo $json->encode($return);
 break;
开发者ID:jgera,项目名称:sugarcrm_dev,代码行数:31,代码来源:EmailUIAjax.php

示例7: saveAttachment

 function saveAttachment($uid, $partNum, $encoding)
 {
     $partStruct = imap_bodystruct($this->stream, imap_msgno($this->stream, $uid), $partNum);
     $message = imap_fetchbody($this->stream, $uid, $partNum, FT_UID);
     switch ($encoding) {
         case 0:
         case 1:
             $message = imap_8bit($message);
             break;
         case 2:
             $message = imap_binary($message);
             break;
         case 3:
             $message = imap_base64($message);
             break;
         case 4:
             $message = quoted_printable_decode($message);
             break;
     }
     return $message;
 }
开发者ID:kam1katze,项目名称:ocDashboard,代码行数:21,代码来源:imap.php

示例8: sprintf

<?php

$emailAddress = 'postmaster@example.com';
$password = 'someSecretPassword';
$server = 'localhost';
$folder = 'Inbox';
$dsn = sprintf('{%s}%s', $server, $folder);
$mbox = imap_open($dsn, $emailAddress, $password);
if (!$mbox) {
    die('Unable to connect');
}
$status = imap_status($mbox, $dsn, SA_ALL);
$msgs = imap_sort($mbox, SORTDATE, 1, SE_UID);
foreach ($msgs as $msguid) {
    $msgno = imap_msgno($mbox, $msguid);
    $headers = imap_headerinfo($mbox, $msgno);
    $structure = imap_fetchstructure($mbox, $msguid, FT_UID);
    var_dump($headers);
    var_dump($structure);
}
开发者ID:rochefort8,项目名称:tt85,代码行数:20,代码来源:b.php

示例9: getAttachment

 /**
  * return content of messages attachment
  *
  * @return binary attachment
  * @param $id of the message
  * @param $index of the attachment (default: first attachment)
  */
 public function getAttachment($id, $index = 0)
 {
     // find message
     $attachments = false;
     $messageIndex = imap_msgno($this->imap, $id);
     $header = imap_headerinfo($this->imap, $messageIndex);
     $mailStruct = imap_fetchstructure($this->imap, $messageIndex);
     $attachments = $this->getAttachments($this->imap, $messageIndex, $mailStruct, "");
     if ($attachments == false) {
         return false;
     }
     // find attachment
     if ($index > count($attachments)) {
         return false;
     }
     $attachment = $attachments[$index];
     // get attachment body
     $partStruct = imap_bodystruct($this->imap, imap_msgno($this->imap, $id), $attachment['partNum']);
     $filename = $partStruct->dparameters[0]->value;
     $message = imap_fetchbody($this->imap, $id, $attachment['partNum'], FT_UID);
     switch ($attachment['enc']) {
         case 0:
         case 1:
             $message = imap_8bit($message);
             break;
         case 2:
             $message = imap_binary($message);
             break;
         case 3:
             $message = imap_base64($message);
             break;
         case 4:
             $message = quoted_printable_decode($message);
             break;
     }
     return array("name" => $attachment['name'], "size" => $attachment['size'], "content" => $message);
 }
开发者ID:radub,项目名称:php-imap-client,代码行数:44,代码来源:Imap.php

示例10: _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

示例11: 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;
 }
开发者ID:NALSS,项目名称:SuiteCRM,代码行数:45,代码来源:EmailUI.php

示例12: get_message_id_uid

 function get_message_id_uid($params)
 {
     $password = $this->get_user_password($params['username']);
     $mbox = $this->imap_connect($params['username'], $password, $params['folder']);
     $msgno = imap_msgno($mbox, $params['uid']);
     $header = imap_header($mbox, $msgno);
     $message_id = $header->message_id;
     return $header->message_id;
 }
开发者ID:rcrrich,项目名称:UpdatePackages,代码行数:9,代码来源:Record.php

示例13: mail_Scan

 public static function mail_Scan($mbox, $account, $folder, $scan_id)
 {
     $return = [];
     $last_user_uid = self::getUidFolder($account['user_id'], $folder);
     $msgno = imap_msgno($mbox, $last_user_uid);
     $num_msg = imap_num_msg($mbox);
     $get_emails = false;
     if ($msgno == 0 && $num_msg != 0) {
         $last_email_uid = imap_uid($mbox, $num_msg);
         if ($last_user_uid == 1) {
             $get_emails = true;
             $msgno = 1;
         } elseif ($last_email_uid > $last_user_uid) {
             $exit = true;
             while ($exit) {
                 $last_user_uid++;
                 $last_scaned_num = imap_msgno($mbox, $last_user_uid);
                 if ($last_scaned_num != 0) {
                     $exit = false;
                     $msgno = $last_scaned_num;
                 } elseif ($last_user_uid == $last_email_uid) {
                     $exit = false;
                     $msgno = $num_msg;
                 }
             }
             $get_emails = true;
         }
     } else {
         if ($msgno < $num_msg) {
             $get_emails = true;
         }
     }
     if ($get_emails) {
         $return['count'] = 0;
         for ($i = $msgno; $i <= $num_msg; $i++) {
             $OSSMailModel = Vtiger_Record_Model::getCleanInstance('OSSMail');
             self::checkFolderUid($account['user_id'], $folder);
             $uid = imap_uid($mbox, $i);
             $mail_detail = $OSSMailModel->get_mail_detail($mbox, $uid, $i);
             $mail_detail['Account_username'] = $account['username'];
             $mail_detail['Account_user_id'] = $account['user_id'];
             self::executeActions($account, $mail_detail, $folder);
             $adb = PearDatabase::getInstance();
             $adb->pquery("update vtiger_ossmailscanner_folders_uid set uid=? where user_id=? AND folder = ?", array($uid, $account['user_id'], $folder));
             self::update_scan_history($scan_id, array('status' => '1', 'count' => $return['count'], 'action' => 'Action_CronMailScanner'));
             $return['count']++;
         }
     }
     return $return;
 }
开发者ID:rcrrich,项目名称:UpdatePackages,代码行数:50,代码来源:Record.php

示例14: getMessageSequenceNumber

 /**
  * @return int
  */
 public function getMessageSequenceNumber()
 {
     return imap_msgno($this->getStream(), $this->getNumber());
 }
开发者ID:shapecode,项目名称:imap,代码行数:7,代码来源:Message.php

示例15: getMessageNumber

 /**
  * @param $uid
  * @return int
  */
 public function getMessageNumber($uid)
 {
     return imap_msgno($this->getImapStream(), $uid);
 }
开发者ID:pnoreck,项目名称:mailscanner,代码行数:8,代码来源:Mailbox.php


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