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


PHP Mail_mimeDecode::decode方法代码示例

本文整理汇总了PHP中Mail_mimeDecode::decode方法的典型用法代码示例。如果您正苦于以下问题:PHP Mail_mimeDecode::decode方法的具体用法?PHP Mail_mimeDecode::decode怎么用?PHP Mail_mimeDecode::decode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Mail_mimeDecode的用法示例。


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

示例1: execute

 /**
  * メール受信時の処理
  * 
  * @access public
  * @author sakuragawa
  */
 function execute()
 {
     ini_set('memory_limit', -1);
     // 前処理
     $this->beforefilter();
     // メールの読み込み
     $source = file_get_contents("php://stdin");
     if (empty($source)) {
         return;
     }
     // \nをつけてるのは、そのままだとSoftbankの空メールが取得できなかったから
     $source .= "\n";
     $this->hookMail($source);
     // メールをデコード
     //$this->out($this->params2);
     $Decoder = new Mail_mimeDecode($source);
     $mail = $Decoder->decode($this->mailMimeDecodeParams);
     // Fromを取得
     $from = $this->_parseAddress($mail, 'from');
     $this->hookFromAddress($from);
     // Toを取得
     $to = $this->_parseAddress($mail, 'to');
     $this->hookToAddress($to);
     // 本文・添付等をパース
     $this->_parseBody($mail);
     $this->afterfilter();
     // Toを取得
     /*$to = $this->_getTo($mail);
       $this->getTo($to);*/
 }
开发者ID:kozo,项目名称:harpy,代码行数:36,代码来源:harpy.php

示例2: GetMessage

 function GetMessage($message_id, $external_id = 0)
 {
     if (!isset($this->_messageCash[$message_id])) {
         $raw_message = $this->_pop3->getMsg($message_id);
         require_once SYS . '/system/class/email/mime/mimeDecode.php';
         $params['include_bodies'] = true;
         $params['decode_bodies'] = true;
         $params['decode_headers'] = true;
         $decoder = new Mail_mimeDecode($raw_message);
         $msg = $decoder->decode($params);
         //				Dump($msg, true);
         $msg->external_id = $external_id;
         if (isset($msg->headers['date'])) {
             $msg->Moment = strtotime($msg->headers['date']);
         } else {
             $msg->Moment = 0;
         }
         $msg = $this->ProcessMessageBody($msg);
         if (strtoupper($msg->charset) == 'KOI8-R') {
             $msg->body = convert_cyr_string($msg->body, 'koi8-r', 'Windows-1251');
             $msg->headers['subject'] = convert_cyr_string($msg->headers['subject'], 'koi8-r', 'Windows-1251');
             $msg->charset = 'Windows-1251';
         }
         $this->_messageCash[$message_id] = $msg;
         $this->got_inner_body = null;
     }
     return $this->_messageCash[$message_id];
 }
开发者ID:juliogallardo1326,项目名称:proc,代码行数:28,代码来源:nsemail.class.php

示例3: decode

 function decode()
 {
     $params = array('crlf' => "\r\n", 'input' => $this->mime_message, 'include_bodies' => $this->include_bodies, 'decode_headers' => $this->decode_headers, 'decode_bodies' => $this->decode_bodies);
     $this->splitBodyHeader();
     $this->struct = Mail_mimeDecode::decode($params);
     return PEAR::isError($this->struct) || !(count($this->struct->headers) > 1) ? FALSE : TRUE;
 }
开发者ID:supaket,项目名称:helpdesk,代码行数:7,代码来源:class.mailparse.php

示例4: processemail

 public static function processemail($emailsrc, $pdfout, $coverfile = '')
 {
     $combfilelist = array();
     # Process the email
     $emailparts = Mail_mimeDecode::decode(array('include_bodies' => true, 'decode_bodies' => true, 'decode_headers' => true, 'input' => file_get_contents($emailsrc), 'crlf' => "\r\n"));
     # Process the cover if it exists
     if ($coverfile !== '') {
         $combfilelist[] = self::processpart(file_get_contents($coverfile), mime_content_type($coverfile));
     }
     # Process the parts
     $combfilelist = array_merge($combfilelist, self::processparts($emailparts));
     # Create an intermediate file to build the pdf
     $tmppdffilename = sys_get_temp_dir() . '/e2p-' . (string) abs((int) (microtime(true) * 100000)) . '.pdf';
     # Build the command to combine all of the intermediate files into one
     $conbcom = str_replace(array_merge(array('INTFILE', 'COMBLIST'), array_keys(self::$driver_paths)), array_merge(array($tmppdffilename, implode(' ', $combfilelist)), array_values(self::$driver_paths)), self::$mime_drivers['gs']);
     exec($conbcom);
     # Remove the intermediate files
     foreach ($combfilelist as $combfilename) {
         unlink($combfilename);
     }
     # Write the intermediate file to the final destination
     $intfileres = fopen($tmppdffilename, 'rb');
     $outfileres = fopen($pdfout, 'ab');
     while (!feof($intfileres)) {
         fwrite($outfileres, fread($intfileres, 8192));
     }
     fclose($intfileres);
     fclose($outfileres);
     # Remove the intermediate file
     unlink($tmppdffilename);
 }
开发者ID:swk,项目名称:bluebox,代码行数:31,代码来源:emailtopdf.php

示例5: testMimeDecode

function testMimeDecode($file, $new_file)
{
    if (!defined('LOGLEVEL')) {
        define('LOGLEVEL', LOGLEVEL_DEBUG);
    }
    if (!defined('LOGUSERLEVEL')) {
        define('LOGUSERLEVEL', LOGLEVEL_DEVICEID);
    }
    printf("TEST MIME DECODE\n");
    $mobj = new Mail_mimeDecode(file_get_contents($file));
    $message = $mobj->decode(array('decode_headers' => true, 'decode_bodies' => true, 'include_bodies' => true, 'charset' => 'utf-8'));
    $handle = fopen($new_file, "w");
    fwrite($handle, build_mime_message($message));
    fclose($handle);
    foreach ($message->headers as $k => $v) {
        if (is_array($v)) {
            foreach ($v as $vk => $vv) {
                printf("Header <%s> <%s> <%s>\n", $k, $vk, $vv);
            }
        } else {
            printf("Header <%s> <%s>\n", $k, $v);
        }
    }
    $text = $html = "";
    Mail_mimeDecode::getBodyRecursive($message, "plain", $text);
    Mail_mimeDecode::getBodyRecursive($message, "html", $html);
    printf("TEXT Body <%s>\n", $text);
    printf("HTML Body <%s>\n", $html);
}
开发者ID:SvKn,项目名称:Z-Push-contrib,代码行数:29,代码来源:testing-mime-mail-parse.php

示例6: transport_email_receive

function transport_email_receive($pMsg)
{
    global $gBitUser, $gBitSystem;
    // prolly dont need this
    // $connectionString = '{'.$gBitSystem->getConfig('transport_email_server','imap').':'.$gBitSystem->getConfig('transport_email_port','993').'/'.$gBitSystem->getConfig('transport_email_protocol','imap').'/ssl/novalidate-cert}';
    // Parse msg - get header, body, attachments, to, from, reply header
    if (include_once 'PEAR.php') {
        if (require_once 'Mail/mimeDecode.php') {
            $params['include_bodies'] = true;
            $params['decode_bodies'] = true;
            $params['decode_headers'] = true;
            $decoder = new Mail_mimeDecode($pMsg);
            if ($data = $decoder->decode($params)) {
                if ($handler($data)) {
                    transport_email_expunge($pMsg);
                }
            } else {
                //error
            }
        } else {
            //error
        }
    } else {
        //error
    }
}
开发者ID:bitweaver,项目名称:switchboard,代码行数:26,代码来源:transport.php

示例7: decode

 /**
  * メールをデコード
  *
  * @access public
  * @param string メールの生データ
  */
 function decode($raw_mail)
 {
     $params['include_bodies'] = true;
     $params['decode_bodies'] = true;
     $params['decode_headers'] = true;
     $params['input'] = $raw_mail;
     $this->mail =& Mail_mimeDecode::decode($params);
 }
开发者ID:KimuraYoichi,项目名称:PukiWiki,代码行数:14,代码来源:KtaiMail.php

示例8: parse

 public function parse($input)
 {
     $decoder = new Mail_mimeDecode($input, "\r\n");
     $structure = $decoder->decode(array('include_bodies' => true, 'decode_bodies' => true));
     $raw_mail = (array) $structure;
     $raw_mail['body'] = $this->getBody($structure);
     return $raw_mail;
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:8,代码来源:Parser.class.php

示例9: array

{
    private $paramsDecode = array('decode_headers' => TRUE, 'include_bodies' => TRUE, 'decode_bodies' => TRUE);
    private $_decoded;
    private $_email;
    private $spf;
    private $body;
    private $subject;
    private $fromEmail;
开发者ID:pratikbgit,项目名称:pipe-email-php-reader,代码行数:8,代码来源:EmailPipe.php

示例10: decodeEmail

function decodeEmail($input)
{
    $params['include_bodies'] = true;
    $params['decode_bodies'] = true;
    $params['decode_headers'] = true;
    $decoder = new Mail_mimeDecode($input);
    $structure = $decoder->decode($params);
    return $structure;
}
开发者ID:jeremy-cayrasso,项目名称:dtc,代码行数:9,代码来源:support-receive.php

示例11: process

 public function process()
 {
     $this->init();
     ini_set('memory_limit', -1);
     $debug = app()->request->getParam('debug');
     $params = [];
     //SUPPLIER_PRICES_DIR
     $incoming = $debug ? file_get_contents($this->_rootPath . DS . "eml" . DS . "test.eml") : app()->request->getParam('@letter');
     if (!$incoming) {
         $this->log('не корректное получение письма', true);
     }
     $params = ['include_bodies' => true, 'decode_bodies' => true, 'decode_headers' => true];
     $decoder = new Mail_mimeDecode($incoming);
     $result = $decoder->decode($params);
     preg_match_all('/\\w+([\\.-]?\\w+)*@\\w+([\\.-]?\\w+)*(\\.\\w{2,3})+/', $result->headers["from"], $matches);
     $mail = $matches[0];
     //array with from emails
     if (!$mail) {
         $this->log("не установлен отправитель письма от {$result->headers['from']}", true);
     }
     $this->email = $mail[0];
     // временный тестовый лог
     if (isset($result->headers["subject"]) && is_array($result->headers["subject"])) {
         $this->log("ОШИБКА в ParseLetter-e \nДата: " . CJSON::encode($result), true);
     }
     // Пример: Subject: [supplierId 9255]
     if (isset($result->headers["subject"]) && strpos($result->headers["subject"], 'supplierId') !== false) {
         $subject = $result->headers["subject"];
         preg_match_all('/\\[.*?(\\d+)\\]/i', $subject, $matches);
         $idSupplier = $matches[1][0];
     } else {
         $query = app()->db->createCommand()->select('id_supplier, email')->from('supplier_email c')->join('supplier s', 'c.id_supplier = s.id')->where('email = "' . $this->email . '"')->andWhere('follow_manual = 1')->queryRow();
         $idSupplier = $query['id_supplier'];
     }
     if (!$idSupplier) {
         // $this->log("{$this->email} :: не установлен поставщик или для поставщика отключена настройка 'Следить вручную'", true); //временно выключаем
         Yii::app()->end();
     }
     $this->idSupplier = trim($idSupplier);
     $this->_destFileDir = $this->_rootPath . $this->idSupplier . DS . 'new';
     File::checkPermissions($this->_destFileDir);
     setlocale(LC_ALL, 'ru_RU.UTF8');
     if (isset($result->parts)) {
         foreach ($result->parts as $key => $part) {
             if ($part->ctype_primary == 'multipart') {
                 foreach ($part->parts as $k => $v) {
                     $this->mainProccess($v);
                 }
             } else {
                 $this->mainProccess($part);
             }
         }
     }
 }
开发者ID:amanukian,项目名称:test,代码行数:54,代码来源:ParseLetter.php

示例12: array

 function &_parseMsg(&$msg)
 {
     $arr = array();
     //Parse out attachments/HTML
     $this->_params['input'] = $msg['msg'];
     $structure = Mail_mimeDecode::decode($this->_params);
     $body = $this->_getBody($structure);
     $arr['hash'] = $this->_parseTicketID($structure->headers['subject']);
     $arr['msg'] = $this->_parseBody($body);
     $arr['mime_struct'] = $structure;
     $arr = array_merge($arr, $this->_parseFrom($structure->headers['from']));
     return $arr;
 }
开发者ID:trabisdementia,项目名称:xuups,代码行数:13,代码来源:msgParser.php

示例13: array

 /**
  * Returns a parsed MIME message
  *
  * @param string $text   The text of the message
  *
  * @return array An array with the MIME parsed headers and body.
  */
 function _mimeParse(&$text)
 {
     /* Taken from Horde's MIME/Structure.php */
     require_once 'Mail/mimeDecode.php';
     /* Set up the options for the mimeDecode class. */
     $decode_args = array();
     $decode_args['include_bodies'] = true;
     $decode_args['decode_bodies'] = false;
     $decode_args['decode_headers'] = false;
     $mimeDecode = new Mail_mimeDecode($text, MIME_PART_EOL);
     if (!($structure = $mimeDecode->decode($decode_args))) {
         return false;
     }
     /* Put the object into imap_parsestructure() form. */
     MIME_Structure::_convertMimeDecodeData($structure);
     return array($structure->headers, $ret =& MIME_Structure::parse($structure));
 }
开发者ID:raz0rsdge,项目名称:horde,代码行数:24,代码来源:Outlook.php

示例14: parse

 public function parse($raw)
 {
     $this->raw = $raw;
     // http://pear.php.net/manual/en/package.mail.mail-mimedecode.decode.php
     $decoder = new Mail_mimeDecode($this->raw);
     $this->decoded = $decoder->decode(['decode_headers' => true, 'include_bodies' => true, 'decode_bodies' => true]);
     $this->from = mb_convert_encoding($this->decoded->headers['from'], $this->charset, $this->charset);
     $this->to = mb_convert_encoding($this->decoded->headers['to'], $this->charset, $this->charset);
     $this->subject = mb_convert_encoding($this->decoded->headers['subject'], $this->charset, $this->charset);
     $this->date = mb_convert_encoding($this->decoded->headers['date'], $this->charset, $this->charset);
     $this->from_email = preg_replace('/.*<(.*)>.*/', "\$1", $this->from);
     if (isset($this->decoded->parts) && is_array($this->decoded->parts)) {
         foreach ($this->decoded->parts as $idx => $body_part) {
             $this->decode_part($body_part);
         }
     }
     if (isset($this->decoded->disposition) && $this->decoded->disposition == 'inline') {
         $mime_type = "{$this->decoded->ctype_primary}/{$this->decoded->ctype_secondary}";
         if (isset($this->decoded->d_parameters) && array_key_exists('filename', $this->decoded->d_parameters)) {
             $filename = $this->decoded->d_parameters['filename'];
         } else {
             $filename = 'file';
         }
         if ($this->is_valid_attachment($mime_type)) {
             $this->save_attachment($filename, $this->decoded->body, $mime_type);
         }
         $this->body = "";
     }
     // We might also have uuencoded files. Check for those.
     if (empty($this->body)) {
         $this->body = isset($this->decoded->body) ? $this->decoded->body : "";
     }
     if (preg_match("/begin ([0-7]{3}) (.+)\r?\n(.+)\r?\nend/Us", $this->body) > 0) {
         foreach ($decoder->uudecode($this->body) as $file) {
             // $file = [ 'filename' => $filename, 'fileperm' => $fileperm, 'filedata' => $filedata ]
             $this->save_attachment($file['filename'], $file['filedata']);
         }
         // Strip out all the uuencoded attachments from the body
         while (preg_match("/begin ([0-7]{3}) (.+)\r?\n(.+)\r?\nend/Us", $this->body) > 0) {
             $this->body = preg_replace("/begin ([0-7]{3}) (.+)\r?\n(.+)\r?\nend/Us", "\n", $this->body);
         }
     }
     $this->body = mb_convert_encoding($this->body, $this->charset, $this->charset);
     return $this;
 }
开发者ID:optimumweb,项目名称:php-email-reader-parser,代码行数:45,代码来源:email_parser.php

示例15: parse

 /**
  * 標準入力からメールを読み込み、必要な情報を取得する。
  *
  * @return void
  */
 function parse()
 {
     if (@$this->parsed) {
         return;
     }
     require_once DATA_PATH . '/module/Mail/mimeDecode.php';
     $fp = fopen('php://stdin', 'r');
     // From 行を解析する。
     $from_line = rtrim(fgets($fp));
     if (preg_match('/^From\\s+"?([^\\s"@]+)"?@([^\\s@]+)/', $from_line, $matches)) {
         $this->sender = $matches[1] . '@' . $matches[2];
     } else {
         trigger_error("Invalid from line: {$from_line}");
         $this->sender = null;
     }
     // 残りのヘッダーを解析する。
     $data = '';
     while (!feof($fp)) {
         $data .= fgets($fp);
         if (rtrim($data, "\r\n") == '') {
             break;
         }
     }
     $structure = Mail_mimeDecode::decode(array('input' => $data));
     $this->recipient = @$structure->headers['to'];
     // 宛先アドレスから拡張部分を取得する。
     $pos = strpos($this->recipient, MOBILE_KARA_MAIL_ADDRESS_DELIMITER);
     if ($pos !== false) {
         $extension_and_domain = substr($this->recipient, $pos + 1);
         $pos = strpos($extension_and_domain, '@');
         if ($pos !== false) {
             $this->extension = substr($extension_and_domain, 0, $pos);
         } else {
             $this->extension = $extension_and_domain;
         }
     } else {
         trigger_error("Invalid recipient: {$this->recipient}");
         $this->extension = null;
     }
     $this->parsed = true;
 }
开发者ID:khrisna,项目名称:eccubedrm,代码行数:46,代码来源:SC_MobileKaraMail.php


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