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


PHP Mail_mimePart::encodeHeader方法代码示例

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


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

示例1: encodeHeader

 /**
  * Encodes a header as per RFC2047
  *
  * @param string $name     The header name
  * @param string $value    The header data to encode
  * @param string $charset  Character set name
  * @param string $encoding Encoding name (base64 or quoted-printable)
  *
  * @return string          Encoded header data (without a name)
  * @access public
  * @since 1.5.3
  */
 function encodeHeader($name, $value, $charset, $encoding)
 {
     return Mail_mimePart::encodeHeader($name, $value, $charset, $encoding, $this->_build_params['eol']);
 }
开发者ID:koroder,项目名称:Web-portal-for-academic-institution,代码行数:16,代码来源:mime.php

示例2: encodeHeader

 /**
  * Encodes a header as per RFC2047
  *
  * @param string $name     The header name
  * @param string $value    The header data to encode
  * @param string $charset  Character set name
  * @param string $encoding Encoding name (base64 or quoted-printable)
  *
  * @return string          Encoded header data (without a name)
  * @access public
  * @since 1.5.3
  */
 function encodeHeader($name, $value, $charset, $encoding)
 {
     $mime_part = new Mail_mimePart();
     return $mime_part->encodeHeader($name, $value, $charset, $encoding, $this->_build_params['eol']);
 }
开发者ID:altesien,项目名称:FinalProject,代码行数:17,代码来源:mime.php

示例3: printf

    printf("NO UID\n");
}
$new_attendees = array();
$props = $ical->GetPropertiesByPath('VEVENT/ATTENDEE');
for ($i = 0; $i < count($props); $i++) {
    printf("Attendee Mailto '%s' Status '%s'\n", str_ireplace("MAILTO:", "", $props[$i]->Value()), $props[$i]->Parameters()["PARTSTAT"]);
}
$ical->SetCPParameterValue("VEVENT", "ATTENDEE", "RSVP", null);
// MODIFICATIONS
// METHOD
$ical->SetPValue("METHOD", "REPLY");
//ATTENDEE
$ical->SetCPParameterValue("VEVENT", "ATTENDEE", "PARTSTAT", "ACCEPTED");
$ical->SetCPParameterValue("VEVENT", "ATTENDEE", "PARTSTAT", "TENTATIVE", "MAILTO:user2@zpush.org");
printf("%s\n", $ical->Render());
$mail = new Mail_mimePart();
$headers = array("MIME-version" => "1.0", "From" => $mail->encodeHeader("from", "Pedro Picapiedra <pedro.picapiedra@zpush.org>", "UTF-8"), "To" => $mail->encodeHeader("to", "Pablo Marmol <pablo.marmol@zpush.org>", "UTF-8"), "Date" => gmdate("D, d M Y H:i:s", time()) . " GMT", "Subject" => $mail->encodeHeader("subject", "This is a subject", "UTF-8"), "Content-class" => "urn:content-classes:calendarmessage", "Content-transfer-encoding" => "8BIT");
$mail = new Mail_mimePart($ical->Render(), array("content_type" => "text/calendar; method=REPLY; charset=UTF-8", "headers" => $headers));
$message = "";
$encoded_mail = $mail->encode();
foreach ($encoded_mail["headers"] as $k => $v) {
    $message .= $k . ": " . $v . "\r\n";
}
$message .= "\r\n" . $encoded_mail["body"] . "\r\n";
printf("%s\n", $message);
$props = $ical->GetPropertiesByPath("VTIMEZONE/TZID");
if (count($props) > 0) {
    $tzid = $props[0]->Value();
    printf("TZID %s\n", $props[0]->Value());
}
print_r(TimezoneUtil::GetFullTZFromTZName($tzid));
开发者ID:SvKn,项目名称:Z-Push-contrib,代码行数:31,代码来源:testing-imap_meeting.php

示例4: build_mime_message

/**
 * Creates a MIME message from a decoded MIME message, reencoding and fixing the text.
 *
 * @param array $message array returned from Mail_mimeDecode->decode
 *
 * @access public
 * @return string MIME message
 */
function build_mime_message($message)
{
    $finalEmail = new Mail_mimePart(isset($message->body) ? $message->body : "", array('headers' => $message->headers));
    if (isset($message->parts)) {
        foreach ($message->parts as $part) {
            change_charset_and_add_subparts($finalEmail, $part);
        }
    }
    $mimeHeaders = array();
    $mimeHeaders['headers'] = array();
    $is_mime = false;
    foreach ($message->headers as $key => $value) {
        switch ($key) {
            case 'content-type':
                $new_value = $message->ctype_primary . "/" . $message->ctype_secondary;
                $is_mime = strcasecmp($message->ctype_primary, 'multipart') == 0;
                if (isset($message->ctype_parameters)) {
                    foreach ($message->ctype_parameters as $ckey => $cvalue) {
                        switch ($ckey) {
                            case 'charset':
                                $new_value .= '; charset="UTF-8"';
                                break;
                            case 'boundary':
                                // Do nothing, we are encoding also the headers
                                break;
                            default:
                                $new_value .= '; ' . $ckey . '="' . $cvalue . '"';
                                break;
                        }
                    }
                }
                $mimeHeaders['content_type'] = $new_value;
                break;
            case 'content-transfer-encoding':
                if (strcasecmp($value, "base64") == 0 || strcasecmp($value, "binary") == 0) {
                    $mimeHeaders['encoding'] = "base64";
                } else {
                    $mimeHeaders['encoding'] = "8bit";
                }
                break;
            case 'content-id':
                $mimeHeaders['cid'] = $value;
                break;
            case 'content-location':
                $mimeHeaders['location'] = $value;
                break;
            case 'content-disposition':
                $mimeHeaders['disposition'] = $value;
                break;
            case 'content-description':
                $mimeHeaders['description'] = $value;
                break;
            default:
                if (is_array($value)) {
                    foreach ($value as $v) {
                        $mimeHeaders['headers'][$key] = $v;
                    }
                } else {
                    $mimeHeaders['headers'][$key] = $value;
                }
                break;
        }
    }
    $finalEmail = new Mail_mimePart(isset($message->body) ? $message->body : "", $mimeHeaders);
    unset($mimeHeaders['headers']);
    unset($mimeHeaders);
    if (isset($message->parts)) {
        foreach ($message->parts as $part) {
            change_charset_and_add_subparts($finalEmail, $part);
        }
    }
    $boundary = '=_' . md5(rand() . microtime());
    $finalEmail = $finalEmail->encode($boundary);
    $headers = "";
    $mimePart = new Mail_mimePart();
    foreach ($finalEmail['headers'] as $key => $value) {
        if (is_array($value)) {
            foreach ($values as $ikey => $ivalue) {
                $headers .= $key . ": " . $mimePart->encodeHeader($key, $ivalue, "utf-8", "base64") . "\n";
            }
        } else {
            $headers .= $key . ": " . $mimePart->encodeHeader($key, $value, "utf-8", "base64") . "\n";
        }
    }
    unset($mimePart);
    if ($is_mime) {
        $built_message = "{$headers}\nThis is a multi-part message in MIME format.\n" . $finalEmail['body'];
    } else {
        $built_message = "{$headers}\n" . $finalEmail['body'];
    }
    unset($headers);
    unset($finalEmail);
//.........这里部分代码省略.........
开发者ID:alanturing1,项目名称:Z-Push-contrib,代码行数:101,代码来源:mime_encode.php

示例5: newpost2mail

function newpost2mail($data)
{
    global $config, $mode, $user, $post_data, $phpEx, $phpbb_root_path, $db;
    $version = "beta 21";
    // variables that can be used in newpost2mail.config.php to build an individial subject line
    $post_SITENAME = $config['sitename'];
    $post_FORUMNAME = $data['forum_name'];
    $post_MODE = $mode;
    $post_TOPICTITLE = $data['topic_title'];
    $post_SUBJECT = $post_data['post_subject'];
    $post_USERNAME = $user->data['username'];
    $post_IP = $data['poster_ip'];
    $post_HOST = @gethostbyaddr($post_IP);
    // 3rd party edit?
    if ($mode == "edit" and $post_data[username] != $user->data['username']) {
        $post_EDITOR = $user->data['username'];
        $post_USERNAME = $post_data[username];
    }
    // get forum parents
    foreach (get_forum_parents($post_data) as $temp) {
        $post_FORUMPARENTS .= $temp["0"] . " / ";
        $post_FORUMPARENTS_laquo .= $temp["0"] . " « ";
    }
    // read configuration
    include $phpbb_root_path . 'newpost2mail.config.php';
    // check if the actual mode is set for sending mails
    if ($n2m_MAIL_ON[$mode]) {
        // if there is a language set in newpost2mail.config.php then use that setting.
        // Otherwise read default language from board config and use that.
        $n2m_LANG ? $lang = $n2m_LANG : ($lang = $config['default_lang']);
        // get (translated) phrases and convert them to UTF8
        foreach ($n2m_TEXT[en] as $key => $value) {
            if ($n2m_TEXT[$lang][$key]) {
                $phrase[$key] = utf8_encode($n2m_TEXT[$lang][$key]);
            } else {
                $phrase[$key] = utf8_encode($n2m_TEXT[en][$key]);
            }
        }
        // set variables for later use
        $board_url = generate_board_url();
        if (substr($board_url, -1) != "/") {
            $board_url .= "/";
        }
        $forum_url = $board_url . "viewforum.php?f={$data['forum_id']}";
        $thread_url = $board_url . "viewtopic.php?f={$data['forum_id']}&t={$data['topic_id']}";
        $post_url = $board_url . "viewtopic.php?f={$data['forum_id']}&t={$data['topic_id']}&p={$data['post_id']}#p{$data['post_id']}";
        $u_profile_url = $board_url . "memberlist.php?mode=viewprofile&u={$post_data['poster_id']}";
        $e_profile_url = $board_url . "memberlist.php?mode=viewprofile&u={$post_data['post_edit_user']}";
        $reply_url = $board_url . "posting.php?mode=reply&f={$data['forum_id']}&t={$data['topic_id']}";
        $edit_url = $board_url . "posting.php?mode=edit&f={$data['forum_id']}&p={$data['post_id']}";
        $quote_url = $board_url . "posting.php?mode=quote&f={$data['forum_id']}&p={$data['post_id']}";
        $delete_url = $board_url . "posting.php?mode=delete&f={$data['forum_id']}&p={$data['post_id']}";
        $info_url = $board_url . "mcp.php?i=main&mode=post_details&f={$data['forum_id']}&p={$data['post_id']}";
        $pm_url = $board_url . "ucp.php?i=pm&mode=compose&action=quotepost&p={$data['post_id']}";
        $email_url = $board_url . "memberlist.php?mode=email&u={$post_data['poster_id']}";
        // build the email header
        include_once $phpbb_root_path . 'includes/functions_messenger.' . $phpEx;
        $headers .= "Date: " . date("D, j M Y H:i:s O") . "\n";
        $from = html_entity_decode($user->data['username']) . " <" . (($user->data['user_allow_viewemail'] or $n2m_ALWAYS_SHOW_EMAIL) ? $user->data['user_email'] : $user->data['username'] . "@aegee.org") . ">";
        $headers .= "From: " . Mail_mimePart::encodeHeader("from", $from, "UTF-8") . "\n";
        $headers .= "X-Mailer: newpost2mail {$version} for phpBB3\n";
        $headers .= "MIME-Version: 1.0\n";
        $headers .= "Content-type: text/plain; charset=UTF-8; format=flowed\n";
        // build the email body
        $message = html_entity_decode(str_replace("<br />", "<br />\n", generate_text_for_edit($data[message], $data[bbcode_uid], $post_data[forum_desc_options])["text"]) . "\n\n");
        //convert BBCode to text/plain; format=flowed
        require_once 'JBBCode/Parser.php';
        class QuoteWithOption extends JBBCode\CodeDefinition
        {
            public function __construct()
            {
                parent::__construct();
                $this->setTagName("quote");
                $this->useOption = true;
            }
            public function asHtml(JBBCode\ElementNode $el)
            {
                $result = "\nQuote from " . $el->getAttribute()["quote"] . ":\n";
                foreach (preg_split("/\\R/", $this->getContent($el)) as $line) {
                    $result .= "> " . $line . "\n";
                }
                return $result . "\n";
            }
        }
        class QuoteWithoutOption extends JBBCode\CodeDefinition
        {
            public function __construct()
            {
                parent::__construct();
                $this->setTagName("quote");
            }
            public function asHtml(JBBCode\ElementNode $el)
            {
                $result = "\n";
                foreach (preg_split("/\\R/", $this->getContent($el)) as $line) {
                    $result .= "> " . $line . "\n";
                }
                return $result . "\n";
            }
        }
//.........这里部分代码省略.........
开发者ID:AEGEE,项目名称:newpost2mail,代码行数:101,代码来源:newpost2mail.php


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