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


PHP imap_rfc822_parse_headers函数代码示例

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


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

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

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

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

示例4: fetchHeaders

 private function fetchHeaders($imapResource, $uid) {
     return \imap_rfc822_parse_headers(\imap_fetchheader($imapResource, $uid, \FT_UID));
 }
开发者ID:nathan-gs,项目名称:Calliope,代码行数:3,代码来源:ImapMessage.php

示例5: parse

 protected function parse($rawmessage)
 {
     parent::parse($rawmessage);
     $headers = imap_rfc822_parse_headers($this->rawheader, self::INTERNAL_HOST);
     if (isset($headers->udate)) {
         $this->date = $headers->udate;
     } else {
         if (isset($headers->date) && ($date = \Zeyon\parseTime($headers->date)) !== null) {
             $this->date = $date;
         }
     }
     isset($headers->subject) and $this->subject = self::decodeHeader($headers->subject);
     if (isset($headers->fromaddress)) {
         $address = $headers->from[0];
         $this->sender = self::decodeHeader($headers->fromaddress);
         $this->sender_email = isset($address->mailbox, $address->host) ? "{$address->mailbox}@{$address->host}" : '';
         $this->sender_name = isset($address->personal) ? self::decodeHeader($address->personal) : $this->sender_email;
     }
     if (isset($headers->toaddress)) {
         $address = $headers->to[0];
         $this->to = self::decodeHeader($headers->toaddress);
         $this->to_email = isset($address->mailbox, $address->host) ? "{$address->mailbox}@{$address->host}" : '';
         $this->to_name = isset($address->personal) ? self::decodeHeader($address->personal) : $this->to_email;
         $this->to_count = count($headers->to);
     }
     isset($headers->ccaddress) and $this->cc = self::decodeHeader($headers->ccaddress);
     isset($headers->bccaddress) and $this->bcc = self::decodeHeader($headers->bccaddress);
     isset($headers->reply_toaddress) and $this->replyto = self::decodeHeader($headers->reply_toaddress);
     $this->receipt = self::extractHeaderField($this->rawheader, 'Disposition-Notification-To') !== '' || self::extractHeaderField($this->rawheader, 'Return-Receipt-To') !== '';
     $this->spam = strtolower(self::extractHeaderField($this->rawheader, 'X-Spam-Flag')) === 'yes' || preg_match('/^\\s*\\[spam\\]/i', $this->subject);
 }
开发者ID:dapepe,项目名称:tymio,代码行数:31,代码来源:mail.php

示例6: getEmailFormat

 /**
  * Secret Sauce - Transform an email string
  * response to array key value format
  *
  * @param *string      $email    The actual email
  * @param string|null  $uniqueId The mail UID
  * @param array        $flags    Any mail flags
  *
  * @return array
  */
 private function getEmailFormat($email, $uniqueId = null, array $flags = array())
 {
     //if email is an array
     if (is_array($email)) {
         //make it into a string
         $email = implode("\n", $email);
     }
     //split the head and the body
     $parts = preg_split("/\n\\s*\n/", $email, 2);
     $head = $parts[0];
     $body = null;
     if (isset($parts[1]) && trim($parts[1]) != ')') {
         $body = $parts[1];
     }
     $lines = explode("\n", $head);
     $head = array();
     foreach ($lines as $line) {
         if (trim($line) && preg_match("/^\\s+/", $line)) {
             $head[count($head) - 1] .= ' ' . trim($line);
             continue;
         }
         $head[] = trim($line);
     }
     $head = implode("\n", $head);
     $recipientsTo = $recipientsCc = $recipientsBcc = $sender = array();
     //get the headers
     $headers1 = imap_rfc822_parse_headers($head);
     $headers2 = $this->getHeaders($head);
     //set the from
     $sender['name'] = null;
     if (isset($headers1->from[0]->personal)) {
         $sender['name'] = $headers1->from[0]->personal;
         //if the name is iso or utf encoded
         if (preg_match("/^\\=\\?[a-zA-Z]+\\-[0-9]+.*\\?/", strtolower($sender['name']))) {
             //decode the subject
             $sender['name'] = str_replace('_', ' ', mb_decode_mimeheader($sender['name']));
         }
     }
     $sender['email'] = $headers1->from[0]->mailbox . '@' . $headers1->from[0]->host;
     //set the to
     if (isset($headers1->to)) {
         foreach ($headers1->to as $to) {
             if (!isset($to->mailbox, $to->host)) {
                 continue;
             }
             $recipient = array('name' => null);
             if (isset($to->personal)) {
                 $recipient['name'] = $to->personal;
                 //if the name is iso or utf encoded
                 if (preg_match("/^\\=\\?[a-zA-Z]+\\-[0-9]+.*\\?/", strtolower($recipient['name']))) {
                     //decode the subject
                     $recipient['name'] = str_replace('_', ' ', mb_decode_mimeheader($recipient['name']));
                 }
             }
             $recipient['email'] = $to->mailbox . '@' . $to->host;
             $recipientsTo[] = $recipient;
         }
     }
     //set the cc
     if (isset($headers1->cc)) {
         foreach ($headers1->cc as $cc) {
             $recipient = array('name' => null);
             if (isset($cc->personal)) {
                 $recipient['name'] = $cc->personal;
                 //if the name is iso or utf encoded
                 if (preg_match("/^\\=\\?[a-zA-Z]+\\-[0-9]+.*\\?/", strtolower($recipient['name']))) {
                     //decode the subject
                     $recipient['name'] = str_replace('_', ' ', mb_decode_mimeheader($recipient['name']));
                 }
             }
             $recipient['email'] = $cc->mailbox . '@' . $cc->host;
             $recipientsCc[] = $recipient;
         }
     }
     //set the bcc
     if (isset($headers1->bcc)) {
         foreach ($headers1->bcc as $bcc) {
             $recipient = array('name' => null);
             if (isset($bcc->personal)) {
                 $recipient['name'] = $bcc->personal;
                 //if the name is iso or utf encoded
                 if (preg_match("/^\\=\\?[a-zA-Z]+\\-[0-9]+.*\\?/", strtolower($recipient['name']))) {
                     //decode the subject
                     $recipient['name'] = str_replace('_', ' ', mb_decode_mimeheader($recipient['name']));
                 }
             }
             $recipient['email'] = $bcc->mailbox . '@' . $bcc->host;
             $recipientsBcc[] = $recipient;
         }
     }
//.........这里部分代码省略.........
开发者ID:kamaroly,项目名称:Mail,代码行数:101,代码来源:Imap.php

示例7: _search

 /**
  * SEARCH IMAP
  * @param  Mixed  $filter search filter as String or as Array of searches
  * @param  string $params option filter params
  * @return mixed  $data emails
  */
 private function _search($filter = "ALL", $params = null)
 {
     if (is_array($filter)) {
         $emails = array();
         foreach ($filter as $string) {
             $search = imap_search($this->imap, $string);
             if ($search) {
                 $emails = array_merge($emails, $search);
             }
         }
     } else {
         $emails = imap_search($this->imap, $filter . " " . $params);
     }
     /* if emails are returned, cycle through each... */
     $data = array();
     if ($emails) {
         /* for every email... */
         foreach ($emails as $email_number) {
             /* get information specific to this email */
             $overview = imap_fetch_overview($this->imap, $email_number, 0);
             $this->structure = imap_fetchstructure($this->imap, $email_number, 0);
             /* commented out to speed up email retrieval */
             $headers = imap_rfc822_parse_headers(imap_fetchheader($this->imap, $email_number));
             switch (strtolower($this->structure->subtype)) {
                 case "plain":
                     $partNum = 1;
                     break;
                 case "alternative":
                     $partNum = 1;
                     break;
                 case "mixed":
                     $partNum = 1.2;
                     break;
                 case "html":
                     $partNum = 1.2;
                     break;
             }
             $partNum = 1;
             $message = quoted_printable_decode(imap_fetchbody($this->imap, $email_number, $partNum, FT_PEEK));
             /* get any possible attachments, commented out to speed up email retrieval, we do not want to do this unless we are automatically associating an email with a user */
             // $attachments = $this->getAttachments($email_number);
             $email = array('overview' => $overview[0], 'structure' => $this->structure, 'headers' => $headers, 'message' => $message);
             $data[$email_number] = $email;
         }
     }
     return $data;
 }
开发者ID:houzhenggang,项目名称:cobalt,代码行数:53,代码来源:Mail.php

示例8: getHeaders

 /**
  * Get message headers
  *
  * @return Message\Headers
  */
 public function getHeaders()
 {
     if (null === $this->headers) {
         $headers = imap_rfc822_parse_headers($this->getPlainHeader());
         // check errors.
         $lastError = imap_last_error();
         if ($lastError !== false) {
             if (1 === preg_match('/Unexpected characters at end of address: <(.*)>/', $lastError, $matches)) {
                 /**
                  * Message parsing from, to, cc headers exception occurs.
                  * It's not critical, because problem can be located just in single address from many.
                  * So we can proceed this letter, just drop the notice.
                  */
                 imap_errors();
             }
         }
         $this->headers = new Message\Headers($headers);
     }
     return $this->headers;
 }
开发者ID:shapecode,项目名称:imap,代码行数:25,代码来源:Message.php

示例9: getMessageHeader

 function getMessageHeader($_uid, $_partID = '')
 {
     $msgno = imap_msgno($this->mbox, $_uid);
     if ($_partID == '') {
         $retValue = imap_header($this->mbox, $msgno);
     } else {
         // do it the hard way
         // we need to fetch the headers of another part(message/rfcxxxx)
         $headersPart = imap_fetchbody($this->mbox, $_uid, $_partID . ".0", FT_UID);
         $retValue = imap_rfc822_parse_headers($headersPart);
     }
     #_debug_array($retValue);
     return $retValue;
 }
开发者ID:BackupTheBerlios,项目名称:milaninegw-svn,代码行数:14,代码来源:class.bofelamimail.inc.php

示例10: parseHeaders

 /**
  * Return headers. Parameter are: date, subject, message_id, to, from.
  * 
  * @param string $head
  * @return hash
  */
 public function parseHeaders($head)
 {
     $h = imap_rfc822_parse_headers($head);
     $p = array();
     $p['date'] = $h->date;
     $p['subject'] = $h->subject;
     $p['message_id'] = $h->message_id;
     $p['to'] = $h->toaddress;
     // $h->reply_toaddress, $h->senderaddress
     $p['from'] = $h->fromaddress;
     return $p;
 }
开发者ID:RolandKujundzic,项目名称:rkphplib,代码行数:18,代码来源:IMAP.class.php

示例11: getMessage

 /**
  * Método que entrega rescata un mensaje desde la casilla de correo
  * @param uid UID del mensaje que se desea obtener
  * @param filter Arreglo con filtros a usar para las partes del mensaje. Ej: ['subtype'=>['PLAIN', 'XML'], 'extension'=>['xml']]
  * @return Arreglo con los datos del mensaje, índices: header, body, charset y attachments
  * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]delaf.cl)
  * @version 2016-11-24
  */
 public function getMessage($uid, $filter = [])
 {
     $message = ['header' => imap_rfc822_parse_headers(imap_fetchheader($this->link, $uid, FT_UID)), 'body' => ['plain' => '', 'html' => ''], 'charset' => '', 'attachments' => []];
     $s = imap_fetchstructure($this->link, $uid, FT_UID);
     if (!is_object($s)) {
         return false;
     }
     // el correo es simple y no tiene múltiples partes
     if (empty($s->parts)) {
         $this->getMessagePart($uid, $s, 0, $message);
     } else {
         foreach ($s->parts as $partno0 => $p) {
             if (!$filter) {
                 $this->getMessagePart($uid, $p, $partno0 + 1, $message);
             } else {
                 // si es del subtipo de agrega
                 $subtype = isset($filter['subtype']) ? array_map('strtoupper', $filter['subtype']) : [];
                 if (in_array(strtoupper($p->subtype), $subtype)) {
                     $this->getMessagePart($uid, $p, $partno0 + 1, $message);
                 } else {
                     if (isset($filter['extension']) and ($p->ifdisposition and strtoupper($p->disposition) == 'ATTACHMENT' or $p->subtype == 'OCTET-STREAM' and ($p->ifparameters or $p->ifdparameters))) {
                         $extension = array_map('strtolower', $filter['extension']);
                         $add = false;
                         $params = $p->ifparameters ? $p->parameters : ($p->ifdparameters ? $p->dparameters : []);
                         foreach ($params as $parameter) {
                             $value = strpos($parameter->value, '=?UTF-8?Q?') === 0 ? imap_utf8($parameter->value) : $parameter->value;
                             if (in_array(strtolower(substr($value, -3)), $extension)) {
                                 $add = true;
                                 break;
                             }
                         }
                         if ($add) {
                             $this->getMessagePart($uid, $p, $partno0 + 1, $message, true);
                         }
                     }
                 }
             }
         }
     }
     // decodificar
     $message['header']->subject = utf8_encode(imap_mime_header_decode($message['header']->subject)[0]->text);
     // entregar mensaje
     return $message;
 }
开发者ID:sowerphp,项目名称:sowerphp,代码行数:52,代码来源:Imap.php

示例12: getHeaders

 /**
  * Set member variable containing header information.  Creates an array containing associative indices
  * referring to various header information.  Use {@link var_dump} or {@link print_r} on the {@link $header}
  * member variable to view information gathered by this function.
  *
  * Returns header information on success and FALSE on failure.
  *
  * @param    int     &$mid           message id
  * @param    string  &$pid           part id
  * @param    int     $from_length    (optional) from length for imap_headerinfo
  * @param    int     $subject_length (optional) subject length for imap_headerinfo
  * @param    string  $default_host   (optional) default host for imap_headerinfo & imap_rfc822_parse_headers
  * @param    int     $options        (optional) flags/options for imap_fetchbody (DEPRECATED, use $this->option['fetchbody'])
  * @return   Array|BOOL
  * @access   public
  * @see      getParts
  * @see      imap_fetchheader
  * @see      imap_fetchbody
  * @see      imap_headerinfo
  * @see      imap_rfc822_parse_headers
  */
 function getHeaders(&$mid, $pid = '0', $from_length = 1024, $subject_length = 1024, $default_host = NULL, $options = NULL)
 {
     if (FALSE === ($hpid = Mail_IMAP::getRawHeaders($mid, $pid, $options, FALSE))) {
         return FALSE;
     }
     // $default_host contains the host information for addresses where it is not
     // present.  Specify it or attempt to use SERVER_NAME
     if ($default_host == NULL && isset($_SERVER['SERVER_NAME']) && !empty($_SERVER['SERVER_NAME'])) {
         $default_host = $_SERVER['SERVER_NAME'];
     } else {
         if ($default_host == NULL) {
             $default_host = 'UNSPECIFIED-HOST-NAME';
         }
     }
     // Parse the headers
     $header_info = $hpid == '0' ? imap_headerinfo($this->mailbox, $mid, $from_length, $subject_length, $default_host) : imap_rfc822_parse_headers($this->rawHeaders[$mid], $default_host);
     // Since individual member variable creation might create extra overhead,
     // and having individual variables referencing this data and the original
     // object would be too much as well, we'll just copy the object into an
     // associative array, preform clean-up on those elements that require it,
     // and destroy the original object after copying.
     if (!is_object($header_info)) {
         PEAR::raiseError('Mail_IMAP::getHeaders: Unable to retrieve header object, invalid part id: ' . $pid, NULL, PEAR_ERROR_TRIGGER, E_USER_WARNING);
         return FALSE;
     }
     $headers = get_object_vars($header_info);
     foreach ($headers as $key => $value) {
         if (!is_object($value) && !is_array($value)) {
             $this->header[$mid][$key] = $value;
         }
     }
     // copy udate or create it from date string.
     $this->header[$mid]['udate'] = isset($header_info->udate) && !empty($header_info->udate) ? $header_info->udate : strtotime($header_info->Date);
     // clean up addresses
     $line[] = 'from';
     $line[] = 'reply_to';
     $line[] = 'sender';
     $line[] = 'return_path';
     $line[] = 'to';
     $line[] = 'cc';
     $line[] = 'bcc';
     for ($i = 0; $i < count($line); $i++) {
         if (isset($header_info->{$line}[$i])) {
             Mail_IMAP::_parseHeaderLine($mid, $header_info->{$line}[$i], $line[$i]);
         }
     }
     // All possible information has been copied, destroy original object
     unset($header_info);
     return $this->header[$mid];
 }
开发者ID:manishkhanchandani,项目名称:mkgxy,代码行数:71,代码来源:IMAP.php

示例13: session_start

<?php

session_start();
$uid = $_GET['uid'];
$gmail = 'gmail.com';
$yahoo = 'mail.yahoo.com';
$mbox = imap_open("{imap." . $_COOKIE['boxmail'] . ":993/imap/ssl}", $_COOKIE['email'], $_COOKIE['pass']);
if (FALSE === $mbox) {
    die('echec !!!');
} else {
    $headerText = imap_fetchHeader($mbox, $uid, FT_UID);
    $header = imap_rfc822_parse_headers($headerText);
    // REM: Attention s'il y a plusieurs sections
    $corps = imap_fetchbody($mbox, $uid, 1, FT_UID);
}
imap_close($mbox);
$from = $header->from;
$msg = "Message de:" . $from[0]->personal . " [" . $from[0]->mailbox . "@" . $from[0]->host . "]<br>";
$msg .= $corps;
include '../../vue/formulaire/Info.php';
开发者ID:bravej,项目名称:AARON,代码行数:20,代码来源:detail.php

示例14: saveAttachments

 /**
  * Takes the "parts" attribute of the object that imap_fetchbody() method
  * returns, and recursively goes through looking for objects that have a
  * disposition of "attachement" or "inline"
  * @param int $msgNo The relative message number for the monitored mailbox
  * @param object $parts Array of objects to examine
  * @param string $emailId The GUID of the email saved prior to calling this method
  * @param array $breadcrumb Default 0, build up of the parts mapping
  * @param bool $forDisplay Default false
  */
 function saveAttachments($msgNo, $parts, $emailId, $breadcrumb = '0', $forDisplay)
 {
     global $sugar_config;
     /*
     	Primary body types for a part of a mail structure (imap_fetchstructure returned object)
     	0 => text
     	1 => multipart
     	2 => message
     	3 => application
     	4 => audio
     	5 => image
     	6 => video
     	7 => other
     */
     foreach ($parts as $k => $part) {
         $thisBc = $k + 1;
         if ($breadcrumb != '0') {
             $thisBc = $breadcrumb . '.' . $thisBc;
         }
         $attach = null;
         // check if we need to recurse into the object
         //if($part->type == 1 && !empty($part->parts)) {
         if (isset($part->parts) && !empty($part->parts) && !(isset($part->subtype) && strtolower($part->subtype) == 'rfc822')) {
             $this->saveAttachments($msgNo, $part->parts, $emailId, $thisBc, $forDisplay);
             continue;
         } elseif ($part->ifdisposition && strtolower($part->subtype) != 'rfc822') {
             // we will take either 'attachments' or 'inline'
             if (strtolower($part->disposition) == 'attachment' || strtolower($part->disposition) == 'inline' && $part->type != 0) {
                 $attach = $this->getNoteBeanForAttachment($emailId);
                 $fname = $this->handleEncodedFilename($this->retrieveAttachmentNameFromStructure($part));
                 if (!empty($fname)) {
                     //assign name to attachment
                     $attach->name = $fname;
                 } else {
                     //if name is empty, default to filename
                     $attach->name = urlencode($this->retrieveAttachmentNameFromStructure($part));
                 }
                 $attach->filename = $attach->name;
                 if (empty($attach->filename)) {
                     continue;
                 }
                 // deal with the MIME types email has
                 $attach->file_mime_type = $this->getMimeType($part->type, $part->subtype);
                 $attach->safeAttachmentName();
                 if ($forDisplay) {
                     $attach->id = $this->getTempFilename();
                 } else {
                     // only save if doing a full import, else we want only the binaries
                     $attach->save();
                 }
             }
             // end if disposition type 'attachment'
         } elseif ($part->type == 2 && isset($part->subtype) && strtolower($part->subtype) == 'rfc822') {
             $tmp_eml = imap_fetchbody($this->conn, $msgNo, $thisBc);
             $rfcheaders = imap_rfc822_parse_headers($tmp_eml);
             $attach = $this->getNoteBeanForAttachment($emailId);
             $attach->file_mime_type = 'message/rfc822';
             $attach->description = $tmp_eml;
             $attach->filename = $attach->name = $rfcheaders->subject . ".eml";
             $attach->safeAttachmentName();
             if ($forDisplay) {
                 $attach->id = $this->getTempFilename();
             } else {
                 // only save if doing a full import, else we want only the binaries
                 $attach->save();
             }
         } elseif (!$part->ifdisposition && $part->type != 1 && $part->type != 2 && $thisBc != '1') {
             // No disposition here, but some IMAP servers lie about disposition headers, try to find the truth
             // Also Outlook puts inline attachments as type 5 (image) without a disposition
             if ($part->ifparameters) {
                 foreach ($part->parameters as $param) {
                     if (strtolower($param->attribute) == "name" || strtolower($param->attribute) == "filename") {
                         $fname = $this->handleEncodedFilename($param->value);
                         break;
                     }
                 }
                 if (empty($fname)) {
                     continue;
                 }
                 // we assume that named parts are attachments too
                 $attach = $this->getNoteBeanForAttachment($emailId);
                 $attach->filename = $attach->name = $fname;
                 $attach->file_mime_type = $this->getMimeType($part->type, $part->subtype);
                 $attach->safeAttachmentName();
                 if ($forDisplay) {
                     $attach->id = $this->getTempFilename();
                 } else {
                     // only save if doing a full import, else we want only the binaries
                     $attach->save();
                 }
//.........这里部分代码省略.........
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:101,代码来源:InboundEmail.php

示例15: getHeaders

 function getHeaders()
 {
     if ($this->headers === null) {
         $this->headers = imap_rfc822_parse_headers($this->getRawHeaders());
     }
     return $this->headers;
 }
开发者ID:jagermesh,项目名称:bright,代码行数:7,代码来源:BrIMAP.php


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