• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Horde_Mime_Part类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: __construct

 /**
  * Constructor.
  *
  * @param Horde_Mime_Part $mime_part  A MIME part object. Must be of
  *                                    type multipart/related.
  */
 public function __construct(Horde_Mime_Part $mime_part)
 {
     if ($mime_part->getType() != 'multipart/related') {
         throw new InvalidArgumentException('MIME part must be of type multipart/related');
     }
     $id = null;
     $ids = array();
     $related_id = $mime_part->getMimeId();
     /* Build a list of parts -> CIDs. */
     foreach ($mime_part->partIterator() as $val) {
         $part_id = $val->getMimeId();
         $ids[] = $part_id;
         if (strcmp($related_id, $part_id) !== 0 && ($cid = $val->getContentId())) {
             $this->_cids[$part_id] = $cid;
         }
     }
     /* Look at the 'start' parameter to determine which part to start
      * with. If no 'start' parameter, use the first part (RFC 2387
      * [3.1]). */
     if ($start = $mime_part->getContentTypeParameter('start')) {
         $id = $this->cidSearch(trim($start, '<> '));
     }
     if (empty($id)) {
         reset($ids);
         $id = next($ids);
     }
     $this->_start = $id;
 }
开发者ID:x59,项目名称:horde-mime,代码行数:34,代码来源:Related.php


示例2: verifyIdentity

 /**
  * Sends a message to an email address supposed to be added to the
  * identity.
  *
  * A message is send to this address containing a time-sensitive link to
  * confirm that the address really belongs to that user.
  *
  * @param integer $id       The identity's ID.
  * @param string $old_addr  The old From: address.
  *
  * @throws Horde_Mime_Exception
  */
 public function verifyIdentity($id, $old_addr)
 {
     global $injector, $notification, $registry;
     $hash = strval(new Horde_Support_Randomid());
     $pref = $this->_confirmEmail();
     $pref[$hash] = $this->get($id);
     $pref[$hash][self::EXPIRE] = time() + self::EXPIRE_SECS;
     $this->_confirmEmail($pref);
     $new_addr = $this->getValue($this->_prefnames['from_addr'], $id);
     $confirm = Horde::url($registry->getServiceLink('emailconfirm')->add('h', $hash)->setRaw(true), true);
     $message = sprintf(Horde_Core_Translation::t("You have requested to add the email address \"%s\" to the list of your personal email addresses.\n\nGo to the following link to confirm that this is really your address:\n%s\n\nIf you don't know what this message means, you can delete it."), $new_addr, $confirm);
     $msg_headers = new Horde_Mime_Headers();
     $msg_headers->addHeaderOb(Horde_Mime_Headers_MessageId::create());
     $msg_headers->addHeaderOb(Horde_Mime_Headers_UserAgent::create());
     $msg_headers->addHeaderOb(Horde_Mime_Headers_Date::create());
     $msg_headers->addHeader('To', $new_addr);
     $msg_headers->addHeader('From', $old_addr);
     $msg_headers->addHeader('Subject', Horde_Core_Translation::t("Confirm new email address"));
     $body = new Horde_Mime_Part();
     $body->setType('text/plain');
     $body->setContents(Horde_String::wrap($message, 76));
     $body->setCharset('UTF-8');
     $body->send($new_addr, $msg_headers, $injector->getInstance('Horde_Mail'));
     $notification->push(sprintf(Horde_Core_Translation::t("A message has been sent to \"%s\" to verify that this is really your address. The new email address is activated as soon as you confirm this message."), $new_addr), 'horde.message');
 }
开发者ID:raz0rsdge,项目名称:horde,代码行数:37,代码来源:Identity.php


示例3: _getEmbeddedMimeParts

 /**
  * If this MIME part can contain embedded MIME part(s), and those part(s)
  * exist, return a representation of that data.
  *
  * @return mixed  A Horde_Mime_Part object representing the embedded data.
  *                Returns null if no embedded MIME part(s) exist.
  */
 protected function _getEmbeddedMimeParts()
 {
     /* Get the data from the attachment. */
     try {
         if (!($tnef = $this->getConfigParam('tnef'))) {
             $tnef = Horde_Compress::factory('Tnef');
             $this->setConfigParam('tnef', $tnef);
         }
         $tnefData = $tnef->decompress($this->_mimepart->getContents());
     } catch (Horde_Compress_Exception $e) {
         $tnefData = array();
     }
     if (!count($tnefData)) {
         return null;
     }
     $mixed = new Horde_Mime_Part();
     $mixed->setType('multipart/mixed');
     reset($tnefData);
     while (list(, $data) = each($tnefData)) {
         $temp_part = new Horde_Mime_Part();
         $temp_part->setName($data['name']);
         $temp_part->setDescription($data['name']);
         $temp_part->setContents($data['stream']);
         /* Short-circuit MIME-type guessing for winmail.dat parts;
          * we're showing enough entries for them already. */
         $type = $data['type'] . '/' . $data['subtype'];
         if (in_array($type, array('application/octet-stream', 'application/base64'))) {
             $type = Horde_Mime_Magic::filenameToMIME($data['name']);
         }
         $temp_part->setType($type);
         $mixed->addPart($temp_part);
     }
     return $mixed;
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:41,代码来源:Tnef.php


示例4: matchStructure

 /**
  */
 public function matchStructure(Horde_Mime_Part $data)
 {
     foreach ($data->partIterator() as $val) {
         if (IMP_Mime_Attachment::isAttachment($val)) {
             return true;
         }
     }
     return false;
 }
开发者ID:raz0rsdge,项目名称:horde,代码行数:11,代码来源:Attachment.php


示例5: token

 /**
  * Renders a token into text matching the requested format.
  *
  * @param array $options The "options" portion of the token (second
  * element).
  *
  * @return string The text rendered from the token options.
  */
 public function token($options)
 {
     $part = new Horde_Mime_Part();
     $part->setContents($options['text']);
     $part->setType('application/x-extension-' . $options['attr']['type']);
     $viewer = Horde_Mime_Viewer::factory('Horde_Core_Mime_Viewer_Syntaxhighlighter', $part, array('registry' => $GLOBALS['registry']));
     $data = $viewer->render('inline');
     $data = reset($data);
     return $data['data'];
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:18,代码来源:Code2.php


示例6: testStructure

 public function testStructure()
 {
     $this->assertInstanceOf('Horde_Mime_Part', $this->ob->getStructure());
     $test = new Horde_Mime_Part();
     $test->setType('image/foo');
     $this->ob->setStructure($test);
     $serialize_ob = unserialize(serialize($this->ob));
     foreach (array($this->ob, $serialize_ob) as $val) {
         $ret = $val->getStructure();
         $this->assertInstanceOf('Horde_Mime_Part', $ret);
         $this->assertEquals('image/foo', $ret->getType('image/foo'));
     }
 }
开发者ID:horde,项目名称:horde,代码行数:13,代码来源:TestBase.php


示例7: getMultipartMimeMessage

 private function getMultipartMimeMessage($mime_type)
 {
     $envelope = new Horde_Mime_Part();
     $envelope->setType('multipart/mixed');
     $foo = new Horde_Mime_Part();
     $foo->setType('foo/bar');
     $envelope->addPart($foo);
     $kolab = new Horde_Mime_Part();
     $kolab->setType($mime_type);
     $envelope->addPart($kolab);
     $envelope->buildMimeIds();
     return $envelope;
 }
开发者ID:horde,项目名称:horde,代码行数:13,代码来源:MimeTypeTest.php


示例8: report

 /**
  */
 public function report(IMP_Contents $contents, $action)
 {
     global $injector, $registry;
     $imp_compose = $injector->getInstance('IMP_Factory_Compose')->create();
     switch ($this->_format) {
         case 'redirect':
             /* Send the message. */
             try {
                 $imp_compose->redirectMessage($contents->getIndicesOb());
                 $imp_compose->sendRedirectMessage($this->_email, false);
                 return true;
             } catch (IMP_Compose_Exception $e) {
                 $e->log();
             }
             break;
         case 'digest':
         default:
             try {
                 $from_line = $injector->getInstance('IMP_Identity')->getFromLine();
             } catch (Horde_Exception $e) {
                 $from_line = null;
             }
             /* Build the MIME structure. */
             $mime = new Horde_Mime_Part();
             $mime->setType('multipart/digest');
             $rfc822 = new Horde_Mime_Part();
             $rfc822->setType('message/rfc822');
             $rfc822->setContents($contents->fullMessageText(array('stream' => true)));
             $mime->addPart($rfc822);
             $spam_headers = new Horde_Mime_Headers();
             $spam_headers->addMessageIdHeader();
             $spam_headers->addHeader('Date', date('r'));
             $spam_headers->addHeader('To', $this->_email);
             if (!is_null($from_line)) {
                 $spam_headers->addHeader('From', $from_line);
             }
             $spam_headers->addHeader('Subject', sprintf(_("%s report from %s"), $action == IMP_Spam::SPAM ? 'spam' : 'innocent', $registry->getAuth()));
             /* Send the message. */
             try {
                 $recip_list = $imp_compose->recipientList(array('to' => $this->_email));
                 $imp_compose->sendMessage($recip_list['list'], $spam_headers, $mime, 'UTF-8');
                 $rfc822->clearContents();
                 return true;
             } catch (IMP_Compose_Exception $e) {
                 $e->log();
                 $rfc822->clearContents();
             }
             break;
     }
     return false;
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:53,代码来源:Email.php


示例9: testvTodo

 /**
  * @requires extension bcmath
  */
 public function testvTodo()
 {
     $tnef = Horde_Compress::factory('Tnef');
     $mime = Horde_Mime_Part::parseMessage(file_get_contents(__DIR__ . '/fixtures/tnef_task.eml'));
     try {
         $tnef_data = $tnef->decompress($mime->getPart(2)->getContents());
     } catch (Horde_Mapi_Exception $e) {
         $this->markTestSkipped('Horde_Mapi is not available');
     } catch (Horde_Compress_Exception $e) {
         var_dump($e);
     }
     // Test the generated iCalendar.
     $iCal = new Horde_Icalendar();
     if (!$iCal->parsevCalendar($tnef_data[0]['stream'])) {
         throw new Horde_Compress_Exception(_("There was an error importing the iCalendar data."));
     }
     $this->assertEquals($iCal->getAttribute('METHOD'), 'REQUEST');
     $components = $iCal->getComponents();
     if (count($components) == 0) {
         throw new Horde_Compress_Exception(_("No iCalendar data was found."));
     }
     $vTodo = current($components);
     $this->assertEquals($vTodo->getAttribute('SUMMARY'), 'Test Task');
     $this->assertEquals($vTodo->getAttribute('UID'), 'EDF71E6FA6FB69A79D79FE1D6DCDBBD300000000DFD9B6FB');
     $this->assertEquals($vTodo->getAttribute('ATTENDEE'), 'Michael Rubinsky <[email protected]>');
     $params = $vTodo->getAttribute('ATTENDEE', true);
     if (!$params) {
         throw new Horde_Compress_Exception('Could not find expected parameters.');
     }
     $this->assertEquals($params[0]['ROLE'], 'REQ-PARTICIPANT');
     $this->assertEquals($vTodo->getAttribute('ORGANIZER'), 'mailto: [email protected]');
 }
开发者ID:raz0rsdge,项目名称:horde,代码行数:35,代码来源:TnefTest.php


示例10: testIconvHtmlMessage

 public function testIconvHtmlMessage()
 {
     $conn = $this->getMockBuilder('Horde_Imap_Client_Socket')->disableOriginalConstructor()->setMethods(['fetch'])->getMock();
     $urlGenerator = $this->getMockBuilder('\\OCP\\IURLGenerator')->disableOriginalConstructor()->getMock();
     //linkToRoute 'mail.proxy.proxy'
     $urlGenerator->expects($this->any())->method('linkToRoute')->will($this->returnCallback(function ($url) {
         return "https://docs.example.com/server/go.php?to={$url}";
     }));
     $htmlService = new \OCA\Mail\Service\Html($urlGenerator);
     // mock first fetch
     $firstFetch = new Horde_Imap_Client_Data_Fetch();
     $firstPart = Horde_Mime_Part::parseMessage(file_get_contents(__DIR__ . '/data/mail-message-123.txt'), ['level' => 1]);
     $firstFetch->setStructure($firstPart);
     $firstFetch->setBodyPart(1, $firstPart->getPart(1)->getContents());
     $firstFetch->setBodyPart(2, $firstPart->getPart(2)->getContents());
     $firstResult = new Horde_Imap_Client_Fetch_Results();
     $firstResult[123] = $firstFetch;
     $conn->expects($this->any())->method('fetch')->willReturn($firstResult);
     $message = new \OCA\Mail\Message($conn, 'INBOX', 123, null, true, $htmlService);
     $htmlBody = $message->getHtmlBody(0, 0, 123, function () {
         return null;
     });
     $this->assertTrue(strlen($htmlBody) > 1000);
     $plainTextBody = $message->getPlainBody();
     $this->assertTrue(strlen($plainTextBody) > 1000);
 }
开发者ID:jakobsack,项目名称:mail,代码行数:26,代码来源:messagetest.php


示例11: test_messageinbound_handler_trim

 /**
  * @dataProvider message_inbound_handler_trim_testprovider
  */
 public function test_messageinbound_handler_trim($file, $source, $expectedplain, $expectedhtml)
 {
     $this->resetAfterTest();
     $mime = Horde_Mime_Part::parseMessage($source);
     if ($plainpartid = $mime->findBody('plain')) {
         $messagedata = new stdClass();
         $messagedata->plain = $mime->getPart($plainpartid)->getContents();
         $messagedata->html = '';
         list($message, $format) = test_handler::remove_quoted_text($messagedata);
         list($message, $expectedplain) = preg_replace("#\r\n#", "\n", array($message, $expectedplain));
         // Normalise line endings on both strings.
         $this->assertEquals($expectedplain, $message);
         $this->assertEquals(FORMAT_PLAIN, $format);
     }
     if ($htmlpartid = $mime->findBody('html')) {
         $messagedata = new stdClass();
         $messagedata->plain = '';
         $messagedata->html = $mime->getPart($htmlpartid)->getContents();
         list($message, $format) = test_handler::remove_quoted_text($messagedata);
         // Normalise line endings on both strings.
         list($message, $expectedhtml) = preg_replace("#\r\n#", "\n", array($message, $expectedhtml));
         $this->assertEquals($expectedhtml, $message);
         $this->assertEquals(FORMAT_PLAIN, $format);
     }
 }
开发者ID:Keneth1212,项目名称:moodle,代码行数:28,代码来源:messageinbound_test.php


示例12: testInvite

 /**
  * Test creating a Horde_ActiveSync_Message_MeetingRequest from a MIME Email
  */
 public function testInvite()
 {
     $this->markTestIncomplete('Has issues on 32bit systems');
     $fixture = file_get_contents(__DIR__ . '/fixtures/invitation_one.eml');
     $mime = Horde_Mime_Part::parseMessage($fixture);
     $msg = new Horde_ActiveSync_Message_MeetingRequest();
     foreach ($mime->contentTypeMap() as $id => $type) {
         if ($type == 'text/calendar') {
             $vcal = new Horde_Icalendar();
             $vcal->parseVcalendar($mime->getPart($id)->getContents());
             $msg->fromvEvent($vcal);
             break;
         }
     }
     $stream = fopen('php://memory', 'wb+');
     $encoder = new Horde_ActiveSync_Wbxml_Encoder($stream);
     $msg->encodeStream($encoder);
     rewind($stream);
     $results = stream_get_contents($stream);
     fclose($stream);
     $stream = fopen(__DIR__ . '/fixtures/meeting_request_one.wbxml', 'r+');
     $expected = '';
     // Using file_get_contents or even fread mangles the binary data for some
     // reason.
     while ($line = fgets($stream)) {
         $expected .= $line;
     }
     fclose($stream);
     $this->assertEquals($expected, $results);
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:33,代码来源:InviteTest.php


示例13: testHasiCalendar

 public function testHasiCalendar()
 {
     $fixture = file_get_contents(__DIR__ . '/fixtures/invitation_one.eml');
     $mime = new Horde_ActiveSync_Mime(Horde_Mime_Part::parseMessage($fixture));
     $this->assertEquals(true, $mime->hasAttachments());
     $this->assertEquals(false, $mime->isSigned());
     $this->assertEquals(true, (bool) $mime->hasiCalendar());
 }
开发者ID:raz0rsdge,项目名称:horde,代码行数:8,代码来源:MimeTest.php


示例14: isAttachment

 /**
  * Determines if a MIME type is an attachment.
  *
  * @param Horde_Mime_Part $part  The MIME part.
  */
 public static function isAttachment(Horde_Mime_Part $part)
 {
     $type = $part->getType();
     switch ($type) {
         case 'application/ms-tnef':
         case 'application/pgp-keys':
         case 'application/vnd.ms-tnef':
             return false;
     }
     if ($part->parent) {
         switch ($part->parent->getType()) {
             case 'multipart/encrypted':
                 switch ($type) {
                     case 'application/octet-stream':
                         return false;
                 }
                 break;
             case 'multipart/signed':
                 switch ($type) {
                     case 'application/pgp-signature':
                     case 'application/pkcs7-signature':
                     case 'application/x-pkcs7-signature':
                         return false;
                 }
                 break;
         }
     }
     switch ($part->getDisposition()) {
         case 'attachment':
             return true;
     }
     switch ($part->getPrimaryType()) {
         case 'application':
             if (strlen($part->getName())) {
                 return true;
             }
             break;
         case 'audio':
         case 'video':
             return true;
         case 'multipart':
             return false;
     }
     return false;
 }
开发者ID:raz0rsdge,项目名称:horde,代码行数:50,代码来源:Attachment.php


示例15: _write

 /**
  */
 protected function _write($filename, Horde_Mime_Part $part)
 {
     global $browser;
     try {
         $this->_vfs->write($this->_vfspath, $this->_id, $filename, true);
     } catch (Horde_Vfs_Exception $e) {
         throw new IMP_Compose_Exception($e);
     }
     // Prevent 'jar:' attacks on Firefox.  See Ticket #5892.
     $type = $part->getType();
     if ($browser->isBrowser('mozilla') && in_array(Horde_String::lower($type), array('application/java-archive', 'application/x-jar'))) {
         $type = 'application/octet-stream';
     }
     $md = $this->getMetadata();
     $md->filename = $part->getName(true);
     $md->time = time();
     $md->type = $type;
     $this->saveMetadata($md);
 }
开发者ID:raz0rsdge,项目名称:horde,代码行数:21,代码来源:VfsLinked.php


示例16: testBug10431

    public function testBug10431()
    {
        $text = 'Das könnte zum Beispiel so aussehen, dass wir bei entsprechenden Anfragen diese an eine Kontaktperson bei Euch weiterleiten. Oder Ihr schnürt ein entsprechendes Paket, dass wir in unseren Angeboten mit anführen. Bei erfolgreicher Vermittlung bekämen wir eine Vermittlungsgebühr.
Wir ständen dann weiterhin für 3rd-Level-Support zur Verfügung, d.h. für alle Anfragen des Kunden bzgl. Horde, die nicht zum Tagesgeschäft gehören.';
        $text = Horde_String::convertCharset($text, 'UTF-8', 'ISO-8859-1');
        $textBody = new Horde_Mime_Part();
        $textBody->setType('text/plain');
        $textBody->setCharset('ISO-8859-1');
        $flowed = new Horde_Text_Flowed($text, 'ISO-8859-1');
        $flowed->setDelSp(true);
        $textBody->setContents($flowed->toFlowed());
        $flowed_txt = $textBody->toString(array('headers' => false));
        $textBody2 = new Horde_Mime_Part();
        $textBody2->setType('text/plain');
        $textBody2->setCharset('ISO-8859-1');
        $textBody2->setContents($flowed_txt, array('encoding' => 'quoted-printable'));
        $flowed2 = new Horde_Text_Flowed($textBody2->getContents(), 'ISO-8859-1');
        $flowed2->setMaxLength(0);
        $flowed2->setDelSp(true);
        $this->assertEquals($text, trim($flowed2->toFixed()));
    }
开发者ID:jubinpatel,项目名称:horde,代码行数:21,代码来源:ComposeTest.php


示例17: testReplace

 public function testReplace()
 {
     $part = Horde_Mime_Part::parseMessage(file_get_contents(__DIR__ . '/fixtures/related_msg.txt'));
     $related = new Horde_Mime_Related($part);
     $ob = $related->cidReplace($part['1']->getContents(), array($this, 'callbackTestReplace'));
     $body = $ob->dom->getElementsByTagName('body');
     $this->assertEquals(1, $body->length);
     $this->assertEquals('2', $body->item(0)->getAttribute('background'));
     $body = $ob->dom->getElementsByTagName('img');
     $this->assertEquals(1, $body->length);
     $this->assertEquals('3', $body->item(0)->getAttribute('src'));
 }
开发者ID:raz0rsdge,项目名称:horde,代码行数:12,代码来源:RelatedTest.php


示例18: createMimePart

 /**
  * Generates a Horde_Mime_Part object, in accordance with RFC 3156, that
  * contains a public key.
  *
  * @return Horde_Mime_Part  Object that contains the armored public key.
  */
 public function createMimePart()
 {
     $part = new Horde_Mime_Part();
     $part->setType('application/pgp-keys');
     $part->setHeaderCharset('UTF-8');
     $part->setDescription(Horde_Pgp_Translation::t("PGP Public Key"));
     $part->setContents(strval($this), array('encoding' => '7bit'));
     return $part;
 }
开发者ID:horde,项目名称:horde,代码行数:15,代码来源:PublicKey.php


示例19: _handle


//.........这里部分代码省略.........
                 }
                 break;
             case 'send':
             case 'reply':
             case 'reply2m':
                 // vfreebusy request.
                 if (isset($components[$key]) && $components[$key]->getType() == 'vFreebusy') {
                     $vFb = $components[$key];
                     // Get the organizer details.
                     try {
                         $organizer = parse_url($vFb->getAttribute('ORGANIZER'));
                     } catch (Horde_Icalendar_Exception $e) {
                         break;
                     }
                     $organizerEmail = $organizer['path'];
                     $organizer = $vFb->getAttribute('ORGANIZER', true);
                     $organizerFullEmail = new Horde_Mail_Rfc822_Address($organizerEmail);
                     if (isset($organizer['cn'])) {
                         $organizerFullEmail->personal = $organizer['cn'];
                     }
                     if ($action == 'reply2m') {
                         $startStamp = time();
                         $endStamp = $startStamp + 60 * 24 * 3600;
                     } else {
                         try {
                             $startStamp = $vFb->getAttribute('DTSTART');
                         } catch (Horde_Icalendar_Exception $e) {
                             $startStamp = time();
                         }
                         try {
                             $endStamp = $vFb->getAttribute('DTEND');
                         } catch (Horde_Icalendar_Exception $e) {
                         }
                         if (!$endStamp) {
                             try {
                                 $duration = $vFb->getAttribute('DURATION');
                                 $endStamp = $startStamp + $duration;
                             } catch (Horde_Icalendar_Exception $e) {
                                 $endStamp = $startStamp + 60 * 24 * 3600;
                             }
                         }
                     }
                     $vfb_reply = $registry->call('calendar/getFreeBusy', array($startStamp, $endStamp));
                     // Find out who we are and update status.
                     $identity = $injector->getInstance('IMP_Identity');
                     $email = $identity->getFromAddress();
                     // Build the reply.
                     $msg_headers = new Horde_Mime_Headers();
                     $vCal = new Horde_Icalendar();
                     $vCal->setAttribute('PRODID', '-//The Horde Project//' . $msg_headers->getUserAgent() . '//EN');
                     $vCal->setAttribute('METHOD', 'REPLY');
                     $vCal->addComponent($vfb_reply);
                     $message = _("Attached is a reply to a calendar request you sent.");
                     $body = new Horde_Mime_Part();
                     $body->setType('text/plain');
                     $body->setCharset('UTF-8');
                     $body->setContents(Horde_String::wrap($message, 76));
                     $ics = new Horde_Mime_Part();
                     $ics->setType('text/calendar');
                     $ics->setCharset('UTF-8');
                     $ics->setContents($vCal->exportvCalendar());
                     $ics->setName('icalendar.ics');
                     $ics->setContentTypeParameter('METHOD', 'REPLY');
                     $mime = new Horde_Mime_Part();
                     $mime->addPart($body);
                     $mime->addPart($ics);
                     // Build the reply headers.
                     $msg_headers->addReceivedHeader(array('dns' => $injector->getInstance('Net_DNS2_Resolver'), 'server' => $conf['server']['name']));
                     $msg_headers->addMessageIdHeader();
                     $msg_headers->addHeader('Date', date('r'));
                     $msg_headers->addHeader('From', $email);
                     $msg_headers->addHeader('To', $organizerFullEmail);
                     $identity->setDefault($vars->identity);
                     $replyto = $identity->getValue('replyto_addr');
                     if (!empty($replyto) && !$email->match($replyto)) {
                         $msg_headers->addHeader('Reply-To', $replyto);
                     }
                     $msg_headers->addHeader('Subject', _("Free/Busy Request Response"));
                     // Send the reply.
                     try {
                         $mime->send($organizerEmail, $msg_headers, $injector->getInstance('IMP_Mail'));
                         $notification->push(_("Reply Sent."), 'horde.success');
                         $result = true;
                     } catch (Exception $e) {
                         $notification->push(sprintf(_("Error sending reply: %s."), $e->getMessage()), 'horde.error');
                     }
                 } else {
                     $notification->push(_("Invalid Action selected for this component."), 'horde.warning');
                 }
                 break;
             case 'nosup':
                 // vFreebusy request.
             // vFreebusy request.
             default:
                 $notification->push(_("This action is not supported."), 'horde.warning');
                 break;
         }
     }
     return $result;
 }
开发者ID:DSNS-LAB,项目名称:Dmail,代码行数:101,代码来源:ItipRequest.php


示例20: getMultiPartMessage

 /**
  * Return the response as a MIME message.
  *
  * @param Horde_Itip_Response_Type $type       The response type.
  * @param Horde_Itip_Response_Options $options The options for the response.
  *
  * @return array A list of two object: The mime headers and the mime
  *               message.
  */
 public function getMultiPartMessage(Horde_Itip_Response_Type $type, Horde_Itip_Response_Options $options)
 {
     $message = new Horde_Mime_Part();
     $message->setType('multipart/alternative');
     list($headers, $ics) = $this->getMessage($type, $options);
     $body = new Horde_Mime_Part();
     $body->setType('text/plain');
     $options->prepareMessageMimePart($body);
     $body->setContents(Horde_String::wrap($type->getMessage(), 76));
     $message->addPart($body);
     $message->addPart($ics);
     return array($headers, $message);
 }
开发者ID:raz0rsdge,项目名称:horde,代码行数:22,代码来源:Response.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Horde_Registry类代码示例发布时间:2022-05-23
下一篇:
PHP Horde_Mime_Magic类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap