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


PHP imap_fetchheader函数代码示例

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


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

示例1: createFromImap

 /**
  * Method to read email from imap extension and return Zend Mail Message object.
  *
  * This is bridge while migrating to Zend Mail package supporting reading from imap extension functions.
  *
  * @param resource $mbox
  * @param integer $num
  * @param array $info connection information about connection
  * @return ImapMessage
  */
 public static function createFromImap($mbox, $num, $info)
 {
     // check if the current message was already seen
     list($overview) = imap_fetch_overview($mbox, $num);
     $headers = imap_fetchheader($mbox, $num);
     $content = imap_body($mbox, $num);
     // fill with "\Seen", "\Deleted", "\Answered", ... etc
     $knownFlags = array('recent' => Zend\Mail\Storage::FLAG_RECENT, 'flagged' => Zend\Mail\Storage::FLAG_FLAGGED, 'answered' => Zend\Mail\Storage::FLAG_ANSWERED, 'deleted' => Zend\Mail\Storage::FLAG_DELETED, 'seen' => Zend\Mail\Storage::FLAG_SEEN, 'draft' => Zend\Mail\Storage::FLAG_DRAFT);
     $flags = array();
     foreach ($knownFlags as $flag => $value) {
         if ($overview->{$flag}) {
             $flags[] = $value;
         }
     }
     $message = new self(array('root' => true, 'headers' => $headers, 'content' => $content, 'flags' => $flags));
     // set MailDate to $message object, as it's not available in message headers, only in IMAP itself
     // this likely "message received date"
     $imapheaders = imap_headerinfo($mbox, $num);
     $header = new GenericHeader('X-IMAP-UnixDate', $imapheaders->udate);
     $message->getHeaders()->addHeader($header);
     $message->mbox = $mbox;
     $message->num = $num;
     $message->info = $info;
     return $message;
 }
开发者ID:dabielkabuto,项目名称:eventum,代码行数:35,代码来源:ImapMessage.php

示例2: 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

示例3: listHeaderMessages

 /**
  * Lista o cabeçalho das 100 primeiras mensagens armazenadas
  *
  * @param string $textSearch
  * @return \ZendT_Mail_Service_HeaderMessage[]
  */
 public function listHeaderMessages($textSearch = 'ALL')
 {
     $itens = array();
     $messages = $this->getMailsInfo($this->searchMailbox($textSearch));
     $limitMessage = 100;
     $iMessage = 0;
     foreach ($messages as $message) {
         if ($iMessage == $limitMessage) {
             break;
         }
         $head = imap_rfc822_parse_headers(imap_fetchheader($this->getImapStream(), $message->uid, FT_UID));
         $item = new ZendT_Mail_HeaderMessage();
         $item->id = $head->message_id;
         $item->dateTime = date('Y-m-d H:i:s', isset($head->date) ? strtotime($head->date) : time());
         $item->subject = $this->decodeMimeStr($head->subject, $this->serverEncoding);
         $item->from = strtolower($head->from[0]->mailbox . '@' . $head->from[0]->host);
         $toStrings = array();
         foreach ($head->to as $to) {
             if (!empty($to->mailbox) && !empty($to->host)) {
                 $toEmail = strtolower($to->mailbox . '@' . $to->host);
                 $toName = isset($to->personal) ? $this->decodeMimeStr($to->personal, $this->serverEncoding) : null;
                 $toStrings[] = $toName ? "{$toName} <{$toEmail}>" : $toEmail;
             }
         }
         $item->to = implode(', ', $toStrings);
         $itens[] = $item;
         $iMessage++;
     }
     return $itens;
 }
开发者ID:rtsantos,项目名称:mais,代码行数:36,代码来源:Imap.php

示例4: retrieve_message

function retrieve_message($auth_user, $accountid, $messageid, $fullheaders)
{
    $message = array();
    if (!($auth_user && $messageid && $accountid)) {
        return false;
    }
    $imap = open_mailbox($auth_user, $accountid);
    if (!$imap) {
        return false;
    }
    $header = imap_header($imap, $messageid);
    if (!$header) {
        return false;
    }
    $message['body'] = imap_body($imap, $messageid);
    if (!$message['body']) {
        $message['body'] = "[This message has no body]\n\n\n\n\n\n";
    }
    if ($fullheaders) {
        $message['fullheaders'] = imap_fetchheader($imap, $messageid);
    } else {
        $message['fullheaders'] = '';
    }
    $message['subject'] = $header->subject;
    $message['fromaddress'] = $header->fromaddress;
    $message['toaddress'] = $header->toaddress;
    $message['ccaddress'] = $header->ccaddress;
    $message['date'] = $header->date;
    // note we can get more detailed information by using from and to
    // rather than fromaddress and toaddress, but these are easier
    imap_close($imap);
    return $message;
}
开发者ID:andersonbporto,项目名称:programacao_internet_2015_1,代码行数:33,代码来源:mail_fns.php

示例5: get_message

 function get_message($uid)
 {
     $raw_header = imap_fetchheader($this->stream, $uid, FT_UID);
     $raw_body = imap_body($this->stream, $uid, FT_UID);
     $message = new Email_Parser($raw_header . $raw_body);
     return $message;
 }
开发者ID:optimumweb,项目名称:php-email-reader-parser,代码行数:7,代码来源:email_reader.php

示例6: get_message

	function get_message($msg)
	{
		$header = imap_fetchheader($this->_connection, $msg);
		echo "<h1>header {$msg}:</h1><br>".$header;
		$message = imap_body($this->_connection, $msg);
		echo "<h1>message {$msg}:</h1><br>".$message;
		return $header.$message;
	}
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:8,代码来源:pop3_socket.class.php

示例7: fetch_raw_mail

 function fetch_raw_mail($stream, $msg_num, $flags = 0)
 {
     $flags |= FT_PREFETCHTEXT;
     // do we force use of msg UID's
     if ($this->force_msg_uids == True && !($flags & FT_UID)) {
         $flags |= FT_UID;
     }
     return imap_fetchheader($stream, $msg_num, $flags);
 }
开发者ID:BackupTheBerlios,项目名称:milaninegw-svn,代码行数:9,代码来源:class.mail_dcom_pop3.inc.php

示例8: getImapHeaderInfo

 /**
  * @param $mailId
  * @return object
  */
 public function getImapHeaderInfo($mailId)
 {
     $imapHeader = imap_fetchheader($this->getImapStream(), $mailId, FT_UID);
     $parsed = array();
     $blocks = preg_split('/\\n\\n/', $imapHeader);
     $matches = array();
     foreach ($blocks as $i => $block) {
         $parsed[$i] = array();
         $lines = preg_split('/\\n(([\\w.-]+)\\: *((.*\\n\\s+.+)+|(.*(?:\\n))|(.*))?)/', $block, -1, PREG_SPLIT_DELIM_CAPTURE);
         foreach ($lines as $line) {
             if (preg_match('/^\\n?([\\w.-]+)\\: *((.*\\n\\s+.+)+|(.*(?:\\n))|(.*))?$/', $line, $matches)) {
                 $parsed[$i][$matches[1]] = preg_replace('/\\n +/', ' ', trim($matches[2]));
             }
         }
     }
     return $parsed;
 }
开发者ID:pnoreck,项目名称:mailscanner,代码行数:21,代码来源:Mailbox.php

示例9: headerMsg

 /**
  * Cabesera de mensage
  * 
  * @param  int $numMsg 
  * @return array
  */
 public function headerMsg($numMsg, $uid = false)
 {
     //$numMsg es el uid y no el numero de secuencia
     if ($uid) {
         $numMsg = imap_msgno($this->connect, $numMsg);
     }
     $header = explode("\n", imap_fetchheader($this->connect, $numMsg));
     if (is_array($header) && count($header)) {
         $head = array();
         foreach ($header as $line) {
             // separate name and value
             eregi("^([^:]*): (.*)", $line, $arg);
             $head[$arg[1]] = $arg[2];
         }
     }
     return $head;
 }
开发者ID:ncrousset,项目名称:get-mail-imap,代码行数:23,代码来源:Imap.php

示例10: fetch

 static function fetch($options)
 {
     if ($mbox = imap_open(sprintf('{%1$s:%2$s/%3$s}INBOX', $options['server'], $options['port'], implode('/', $options['settings'])), $options['user'], $options['pass'])) {
         $ret = array();
         if (($messages = imap_num_msg($mbox)) > 0) {
             for ($message = 1; $message < $messages + 1; $message++) {
                 $eml = imap_fetchheader($mbox, $message) . imap_body($mbox, $message);
                 $data = array('Task' => array());
                 $email_data = LilTasksParseEmail::__parseEmailHeader($mbox, $message);
                 $data['Task']['title'] = $email_data['subject'];
                 $data['Task']['happened'] = strftime('%Y-%m-%d', strtotime($email_data['date']));
                 list($sender, $domain) = explode('@', $email_data['from']);
                 if ($sender == 'today') {
                     $data['Task']['deadline'] = strftime('%Y-%m-%d');
                 } else {
                     if ($sender == 'tomorrow') {
                         $data['Task']['deadline'] = strftime('%Y-%m-%d', time() + 24 * 60 * 60);
                     } else {
                         if (in_array(strtolower($sender), array('monday', 'tuesday', 'wednesday', 'thursday', 'saturday', 'sunday'))) {
                             $data['Task']['deadline'] = strftime('%Y-%m-%d', strtotime('next ' . ucfirst($sender)));
                         }
                     }
                 }
                 $hash = sha1($data['Task']['happened'] . '_' . $email_data['subject']);
                 $parts = array();
                 $data['Task']['descript'] = LilTasksParseEmail::__parseEmailBody($mbox, $message, $hash, $parts);
                 file_put_contents(TMP . $hash . '.eml', $eml);
                 $data['Attachment'][0] = array('model' => 'Task', 'filename' => array('name' => $hash . '.eml', 'tmp_name' => TMP . $hash . '.eml'), 'title' => 'SOURCE: ' . $data['Task']['title']);
                 App::uses('Sanitize', 'Utility');
                 foreach ($parts as $part) {
                     if (!empty($part['attachment'])) {
                         $data['Attachment'][] = array('model' => 'Task', 'filename' => array('name' => Sanitize::paranoid($part['attachment']['filename']), 'tmp_name' => $part['attachment']['tmp']), 'title' => $part['attachment']['filename']);
                     }
                 }
                 $ret[$message] = $data;
                 imap_delete($mbox, $message);
             }
         }
         return $ret;
         imap_close($mbox, CL_EXPUNGE);
     } else {
         var_dump(imap_errors());
     }
 }
开发者ID:malamalca,项目名称:lil-tasks,代码行数:44,代码来源:LilTasksParseEmail.php

示例11: email_msg_headers

function email_msg_headers($mbox, $uid)
{
    $raw_header = $mbox && $uid ? @imap_fetchheader($mbox, $uid, FT_UID) : '';
    $raw_header = str_replace("\r", '', $raw_header);
    $ret = array();
    $h = split("\n", $raw_header);
    if (count($h)) {
        foreach ($h as $line) {
            if (preg_match("/^[a-zA-Z]/", $line)) {
                $key = substr($line, 0, strpos($line, ':'));
                $value = substr($line, strpos($line, ':') + 1);
                $last_entry = strtolower($key);
                $ret[$last_entry] = trim($value);
            } else {
                $ret[$last_entry] .= ' ' . trim($line);
            }
        }
    }
    return $ret;
}
开发者ID:nextgensh,项目名称:friendica,代码行数:20,代码来源:email.php

示例12: getHeaders

 function getHeaders($mid)
 {
     if (!$this->marubox) {
         return false;
     }
     $mail_header = @imap_fetchheader($this->marubox, $mid);
     if ($mail_header == false) {
         return false;
     }
     $mail_header = imap_rfc822_parse_headers($mail_header);
     $sender = isset($mail_header->from[0]) ? $mail_header->from[0] : '';
     $sender_replyto = isset($mail_header->reply_to[0]) ? $mail_header->reply_to[0] : '';
     if (strtolower($sender->mailbox) != 'mailer-daemon' && strtolower($sender->mailbox) != 'postmaster') {
         $newvalue['personal'] = $this->email_Decode($sender->personal);
         $newvalue['sender_personal'] = $this->email_Decode($sender_replyto->personal);
         $newvalue['subject'] = $this->email_Decode($mail_header->subject);
         $newvalue['toaddress'] = isset($mail_header->toaddress) ? $this->email_Decode($mail_header->toaddress) : '';
         $mail_header = (array) $mail_header;
         $sender = (array) $sender;
         $mail_details = array('feid' => imap_uid($this->marubox, $mid), 'from' => strtolower($sender['mailbox']) . '@' . $sender['host'], 'from_name' => $newvalue['personal'], 'to_other' => strtolower($sender_replyto->mailbox) . '@' . $sender_replyto->host, 'toname_other' => $newvalue['sender_personal'], 'subjects' => $newvalue['subject'], 'to' => $newvalue['toaddress'], 'time' => strtotime($mail_header['Date']));
     }
     return $mail_details;
 }
开发者ID:knowsee,项目名称:uoke_framework,代码行数:23,代码来源:mail.class.php

示例13: 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

示例14: parseHeader

 private function parseHeader()
 {
     $header = imap_fetchheader($this->client->connection, $this->uid, FT_UID);
     if ($header) {
         $header = imap_rfc822_parse_headers($header);
     }
     if (property_exists($header, 'subject')) {
         $this->subject = imap_utf8($header->subject);
     }
     if (property_exists($header, 'date')) {
         $this->date = Carbon::parse($header->date);
     }
     if (property_exists($header, 'from')) {
         $this->from = $this->parseAddresses($header->from);
     }
     if (property_exists($header, 'to')) {
         $this->to = $this->parseAddresses($header->to);
     }
     if (property_exists($header, 'cc')) {
         $this->cc = $this->parseAddresses($header->cc);
     }
     if (property_exists($header, 'bcc')) {
         $this->bcc = $this->parseAddresses($header->bcc);
     }
     if (property_exists($header, 'reply_to')) {
         $this->reply_to = $this->parseAddresses($header->reply_to);
     }
     if (property_exists($header, 'sender')) {
         $this->sender = $this->parseAddresses($header->sender);
     }
     if (property_exists($header, 'message_id')) {
         $this->message_id = str_replace(['<', '>'], '', $header->message_id);
     }
     if (property_exists($header, 'Msgno')) {
         $this->message_no = trim($header->Msgno);
     }
 }
开发者ID:zalazdi,项目名称:laravel-imap,代码行数:37,代码来源:Message.php

示例15: ob_start

 ob_start();
 $mbox = @imap_open($_email['server'], $_email['username'], $_email['password']);
 if (!$mbox) {
     ob_end_clean();
     sleep(10);
     continue;
 }
 $processed = 0;
 $msgs = @imap_search($mbox, 'UNSEEN');
 if ($msgs) {
     foreach ($msgs as $msgid) {
         // Crap out here if we've run out of time
         if (time() >= $endtime) {
             break;
         }
         $imap_headers = @imap_fetchheader($mbox, $msgid);
         if (!$imap_headers) {
             break;
         }
         $headers = array();
         foreach (explode("\n", trim($imap_headers)) as $header) {
             if (strlen(trim($header)) == 0 or $header[0] == ' ' or $header[0] == "\t") {
                 continue;
             }
             list($key, $val) = explode(':', trim($header));
             $key = strtolower($key);
             $val = trim($val);
             switch ($key) {
                 case 'x-twitterrecipientscreenname':
                     if ($val != $_twitter['username']) {
                         // Skip to the next message - this one is not for us!
开发者ID:ntulip,项目名称:TwitApps,代码行数:31,代码来源:check_email.php


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