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


PHP Message::getBodyText方法代码示例

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


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

示例1: send

 /**
  * Send a mail message
  *
  * @param Mail\Message $message
  * @return array
  */
 public function send(Mail\Message $message)
 {
     $this->getMandrillClient();
     $body = $message->getBody();
     $attachments = [];
     switch (true) {
         case $body instanceof Message:
             $bodyHtml = $this->getHtmlPart($body);
             $bodyText = $this->getTextPart($body);
             $attachments = $this->getAttachments($body);
             break;
         case is_string($body):
             $bodyHtml = $body;
             $bodyText = $message->getBodyText();
             break;
         case is_object($body):
             $bodyHtml = $body->__toString();
             $bodyText = $message->getBodyText();
             break;
         default:
             throw new Exception\InvalidArgumentException(sprintf('"%s" expectes a body that is a string, an object or a Zend\\Mime\\Message; received "%s"', __METHOD__, is_object($body) ? get_class($body) : gettype($body)));
             break;
     }
     $message = ['html' => $bodyHtml, 'text' => $bodyText, 'subject' => $message->getSubject(), 'from_email' => $message->getFrom()->current()->getEmail(), 'from_name' => $message->getFrom()->current()->getName(), 'to' => array_merge($this->mapAddressListToArray($message->getTo(), 'to'), $this->mapAddressListToArray($message->getCc(), 'cc'), $this->mapAddressListToArray($message->getBcc(), 'bcc')), 'headers' => $message->getHeaders()->toArray(), 'subaccount' => $this->options->getSubAccount(), 'attachments' => $attachments];
     return $this->mandrillClient->messages->send($message);
 }
开发者ID:ripaclub,项目名称:zf2-mailman,代码行数:32,代码来源:Mandrill.php

示例2: send

 /**
  * Send a mail message
  *
  * @param \Zend\Mail\Message $message
  * @return array
  */
 public function send(Mail\Message $message)
 {
     $consumer = new Consumer();
     $consumer->setUrl($this->config['url']);
     $params = array('to' => urlencode($this->config['to']), 'subject' => urlencode($message->getSubject()), 'from' => urlencode($message->getFrom()->current()->getEmail()), 'fromname' => urlencode($message->getFrom()->current()->getName()), 'text' => urlencode($message->getBodyText()), 'api_user' => urlencode($this->config['user']), 'api_key' => urlencode($this->config['key']));
     $bcc = $message->getBcc()->current();
     if ($bcc) {
         $params['bcc'] = $bcc->getEmail();
     }
     $consumer->setParams($params);
     $consumer->setResponseType('json');
     $consumer->setCallType('get');
     return $consumer->doApiCall();
 }
开发者ID:sunshinephp,项目名称:ssp-contact,代码行数:20,代码来源:SspSendGridTransport.php

示例3: testRetrievingBodyTextFromMessageWithMultiPartMimeBodyReturnsMimeSerialization

 public function testRetrievingBodyTextFromMessageWithMultiPartMimeBodyReturnsMimeSerialization()
 {
     $mime = new Mime('foo-bar');
     $text = new MimePart('foo');
     $text->type = 'text/plain';
     $html = new MimePart('<b>foo</b>');
     $html->type = 'text/html';
     $body = new MimeMessage();
     $body->setMime($mime);
     $body->addPart($text);
     $body->addPart($html);
     $this->message->setBody($body);
     $text = $this->message->getBodyText();
     $this->assertEquals($body->generateMessage(Headers::EOL), $text);
     $this->assertContains('--foo-bar', $text);
     $this->assertContains('--foo-bar--', $text);
     $this->assertContains('Content-Type: text/plain', $text);
     $this->assertContains('Content-Type: text/html', $text);
 }
开发者ID:nuklehed,项目名称:zf2,代码行数:19,代码来源:MessageTest.php

示例4: getBodyText

 public function getBodyText()
 {
     if (!$this->body) {
         $body = $this->getBody();
     }
     return parent::getBodyText();
 }
开发者ID:ahyswang,项目名称:eva-engine,代码行数:7,代码来源:Message.php

示例5: prepareBody

 /**
  * Prepare body string from message
  * 
  * @param  Message $message 
  * @return string
  */
 protected function prepareBody(Message $message)
 {
     return $message->getBodyText();
 }
开发者ID:nevvermind,项目名称:zf2,代码行数:10,代码来源:Smtp.php

示例6: prepareBody

 /**
  * Prepare the body string
  *
  * @param  \Zend\Mail\Message $message
  * @return string
  */
 protected function prepareBody(Mail\Message $message)
 {
     if (!$this->isWindowsOs()) {
         // *nix platforms can simply return the body text
         return $message->getBodyText();
     }
     // On windows, lines beginning with a full stop need to be fixed
     $text = $message->getBodyText();
     $text = str_replace("\n.", "\n..", $text);
     return $text;
 }
开发者ID:eltondias,项目名称:Relogio,代码行数:17,代码来源:Sendmail.php

示例7: send

 /**
  * @param Message $message
  * @return bool
  */
 public function send(Message $message)
 {
     $this->email->addTo($message->getTo()->current()->getEmail(), $message->getTo()->current()->getName())->setFrom($message->getFrom()->current()->getEmail(), $message->getFrom()->current()->getName())->setSubject($message->getSubject())->setHtml($message->getBodyText());
     $this->sendGrid->send($this->email);
     return true;
 }
开发者ID:andrebian,项目名称:sendgrid-transport-module,代码行数:10,代码来源:SendGridTransport.php

示例8: getMessageText

 /**
  * Gets the raw MIME message text.
  *
  * @param Mail\Message $message
  * @return string
  */
 private function getMessageText(Mail\Message $message)
 {
     return base64_encode($message->getHeaders()->toString() . Mail\Headers::EOL . $message->getBodyText());
 }
开发者ID:owindsor,项目名称:silverstripe-ses,代码行数:10,代码来源:SESMailer.php

示例9: getMessageText

 /**
  * Gets the raw MIME message text.
  *
  * @param Mail\Message $message
  * @return string
  */
 private function getMessageText(Mail\Message $message)
 {
     $raw = $message->getHeaders()->toString() . Mail\Headers::EOL . $message->getBodyText();
     return $raw;
 }
开发者ID:silverstripe-australia,项目名称:silverstripe-sesmail,代码行数:11,代码来源:SESMailer.php


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