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


PHP Mail_mime::setContentType方法代码示例

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


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

示例1: compose_itip_message

 /**
  * Helper function to build a Mail_mime object to send an iTip message
  *
  * @param array   Event object to send
  * @param string  iTip method (REQUEST|REPLY|CANCEL)
  * @param boolean Request RSVP
  * @return object Mail_mime object with message data
  */
 public function compose_itip_message($event, $method, $rsvp = true)
 {
     $from = rcube_utils::idn_to_ascii($this->sender['email']);
     $from_utf = rcube_utils::idn_to_utf8($from);
     $sender = format_email_recipient($from, $this->sender['name']);
     // truncate list attendees down to the recipient of the iTip Reply.
     // constraints for a METHOD:REPLY according to RFC 5546
     if ($method == 'REPLY') {
         $replying_attendee = null;
         $reply_attendees = array();
         foreach ($event['attendees'] as $attendee) {
             if ($attendee['role'] == 'ORGANIZER') {
                 $reply_attendees[] = $attendee;
             } else {
                 if (strcasecmp($attendee['email'], $from) == 0 || strcasecmp($attendee['email'], $from_utf) == 0) {
                     $replying_attendee = $attendee;
                     if ($attendee['status'] != 'DELEGATED') {
                         unset($replying_attendee['rsvp']);
                         // unset the RSVP attribute
                     }
                 } else {
                     if (!empty($attendee['delegated-to']) && (strcasecmp($attendee['delegated-to'], $from) == 0 || strcasecmp($attendee['delegated-to'], $from_utf) == 0) || !empty($attendee['delegated-from']) && (strcasecmp($attendee['delegated-from'], $from) == 0 || strcasecmp($attendee['delegated-from'], $from_utf) == 0)) {
                         $reply_attendees[] = $attendee;
                     }
                 }
             }
         }
         if ($replying_attendee) {
             array_unshift($reply_attendees, $replying_attendee);
             $event['attendees'] = $reply_attendees;
         }
         if ($event['recurrence']) {
             unset($event['recurrence']['EXCEPTIONS']);
         }
     } else {
         if ($method == 'REQUEST') {
             foreach ($event['attendees'] as $i => $attendee) {
                 if (($rsvp || !isset($attendee['rsvp'])) && ($attendee['status'] != 'DELEGATED' && $attendee['role'] != 'NON-PARTICIPANT')) {
                     $event['attendees'][$i]['rsvp'] = (bool) $rsvp;
                 }
             }
         } else {
             if ($method == 'CANCEL') {
                 if ($event['recurrence']) {
                     unset($event['recurrence']['EXCEPTIONS']);
                 }
             }
         }
     }
     // compose multipart message using PEAR:Mail_Mime
     $message = new Mail_mime("\r\n");
     $message->setParam('text_encoding', 'quoted-printable');
     $message->setParam('head_encoding', 'quoted-printable');
     $message->setParam('head_charset', RCUBE_CHARSET);
     $message->setParam('text_charset', RCUBE_CHARSET . ";\r\n format=flowed");
     $message->setContentType('multipart/alternative');
     // compose common headers array
     $headers = array('From' => $sender, 'Date' => $this->rc->user_date(), 'Message-ID' => $this->rc->gen_message_id(), 'X-Sender' => $from);
     if ($agent = $this->rc->config->get('useragent')) {
         $headers['User-Agent'] = $agent;
     }
     $message->headers($headers);
     // attach ics file for this event
     $ical = libcalendaring::get_ical();
     $ics = $ical->export(array($event), $method, false, $method == 'REQUEST' && $this->plugin->driver ? array($this->plugin->driver, 'get_attachment_body') : false);
     $filename = $event['_type'] == 'task' ? 'todo.ics' : 'event.ics';
     $message->addAttachment($ics, 'text/calendar', $filename, false, '8bit', '', RCUBE_CHARSET . "; method=" . $method);
     return $message;
 }
开发者ID:claudineyqr,项目名称:Kolab-Roundcube-Libcalendaring,代码行数:77,代码来源:libcalendaring_itip.php

示例2: compose_itip_message

 /**
  * Helper function to build a Mail_mime object to send an iTip message
  *
  * @param array   Event object to send
  * @param string  iTip method (REQUEST|REPLY|CANCEL)
  * @return object Mail_mime object with message data
  */
 public function compose_itip_message($event, $method)
 {
     $from = rcube_idn_to_ascii($this->sender['email']);
     $from_utf = rcube_idn_to_utf8($from);
     $sender = format_email_recipient($from, $this->sender['name']);
     // truncate list attendees down to the recipient of the iTip Reply.
     // constraints for a METHOD:REPLY according to RFC 5546
     if ($method == 'REPLY') {
         $replying_attendee = null;
         $reply_attendees = array();
         foreach ($event['attendees'] as $attendee) {
             if ($attendee['role'] == 'ORGANIZER') {
                 $reply_attendees[] = $attendee;
             } else {
                 if (strcasecmp($attedee['email'], $from) == 0 || strcasecmp($attendee['email'], $from_utf) == 0) {
                     $replying_attendee = $attendee;
                 }
             }
         }
         if ($replying_attendee) {
             $reply_attendees[] = $replying_attendee;
             $event['attendees'] = $reply_attendees;
         }
     }
     // compose multipart message using PEAR:Mail_Mime
     $message = new Mail_mime("\r\n");
     $message->setParam('text_encoding', 'quoted-printable');
     $message->setParam('head_encoding', 'quoted-printable');
     $message->setParam('head_charset', RCMAIL_CHARSET);
     $message->setParam('text_charset', RCMAIL_CHARSET . ";\r\n format=flowed");
     $message->setContentType('multipart/alternative');
     // compose common headers array
     $headers = array('From' => $sender, 'Date' => $this->rc->user_date(), 'Message-ID' => $this->rc->gen_message_id(), 'X-Sender' => $from);
     if ($agent = $this->rc->config->get('useragent')) {
         $headers['User-Agent'] = $agent;
     }
     $message->headers($headers);
     // attach ics file for this event
     $ical = $this->cal->get_ical();
     $ics = $ical->export(array($event), $method, false, $method == 'REQUEST' ? array($this->cal->driver, 'get_attachment_body') : false);
     $message->addAttachment($ics, 'text/calendar', 'event.ics', false, '8bit', '', RCMAIL_CHARSET . "; method=" . $method);
     return $message;
 }
开发者ID:MetallianFR68,项目名称:myroundcube,代码行数:50,代码来源:calendar_itip.php


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