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


PHP Swift_Message::addReplyTo方法代码示例

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


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

示例1: send

 public function send(Notifications $notification)
 {
     if ($notification->sent == 'Y') {
         return;
     }
     $post = $notification->post;
     $user = $notification->user;
     if ($notification->type != 'P') {
         $reply = $notification->reply;
     } else {
         $reply = true;
     }
     $from = $this->config->mail->fromEmail;
     $url = $this->config->site->url;
     if ($post && $user && $reply) {
         if ($user->email && $user->notifications != 'N' && strpos($user->email, '@users.noreply.github.com') === false) {
             try {
                 $message = new \Swift_Message('[Phalcon Forum] ' . $post->title);
                 $message->setTo(array($user->email => $user->name));
                 $message->addReplyTo('reply-i' . $post->id . '-' . time() . '@phosphorum.com');
                 if ($notification->type == 'P') {
                     $originalContent = $post->content;
                     $htmlContent = $this->markdown->render($post->content);
                     $message->setFrom(array($from => $post->user->name));
                 } else {
                     $reply = $notification->reply;
                     $originalContent = $reply->content;
                     $htmlContent = $this->markdown->render($reply->content);
                     $message->setFrom(array($from => $reply->user->name));
                 }
                 if (trim($originalContent)) {
                     $textContent = nl2br($originalContent);
                     $htmlContent .= '<p style="font-size:small;-webkit-text-size-adjust:none;color:#717171;">';
                     if ($notification->type == 'P') {
                         $htmlContent .= '&mdash;<br>Reply to this email directly or view the complete thread on ' . PHP_EOL . '<a href="' . $url . '/discussion/' . $post->id . '/' . $post->slug . '">Phosphorum</a>. ';
                     } else {
                         $htmlContent .= '&mdash;<br>Reply to this email directly or view the complete thread on ' . PHP_EOL . '<a href="' . $url . '/discussion/' . $post->id . '/' . $post->slug . '#C' . $reply->id . '">Phosphorum</a>. ';
                     }
                     $htmlContent .= PHP_EOL . 'Change your e-mail preferences <a href="' . $url . '/settings">here</a></p>';
                     $bodyMessage = new \Swift_MimePart($htmlContent, 'text/html');
                     $bodyMessage->setCharset('UTF-8');
                     $message->attach($bodyMessage);
                     $bodyMessage = new \Swift_MimePart($textContent, 'text/plain');
                     $bodyMessage->setCharset('UTF-8');
                     $message->attach($bodyMessage);
                     if (!$this->transport) {
                         $this->transport = \Swift_SmtpTransport::newInstance($this->config->smtp->host, $this->config->smtp->port, $this->config->smtp->security);
                         $this->transport->setUsername($this->config->smtp->username);
                         $this->transport->setPassword($this->config->smtp->password);
                     }
                     if (!$this->mailer) {
                         $this->mailer = \Swift_Mailer::newInstance($this->transport);
                     }
                     $this->mailer->send($message);
                 }
             } catch (\Exception $e) {
                 echo $e->getMessage(), PHP_EOL;
             }
         }
     }
     $notification->sent = 'Y';
     if ($notification->save() == false) {
         foreach ($notification->getMessages() as $message) {
             echo $message->getMessage(), PHP_EOL;
         }
     }
 }
开发者ID:Rudianasaja,项目名称:forum,代码行数:67,代码来源:SendSpool.php

示例2: setupMessageHeaders

 /**
  * @param \Swift_Message $instance
  * @param  array  $from              From addresses. An array of (email-address => name)
  * @param  array  $to                To addresses. An array of (email-address => name)
  * @param  array  $cc                Cc addresses. An array of (email-address => name) [optional]
  * @param  array  $bcc               Bcc addresses. An array of (email-address => name) [optional]
  * @param  array  $replyTo           Reply to addresses. An array of (email-address => name) [optional]
  */
 protected function setupMessageHeaders($instance, $from, $to, $cc = [], $bcc = [], $replyTo = [])
 {
     // Add from addresses
     foreach ($from as $address => $name) {
         $instance->addFrom($address, $name);
     }
     // Add to addresses
     foreach ($to as $address => $name) {
         $instance->addTo($address, $name);
     }
     // Add cc addresses
     foreach ($cc as $address => $name) {
         $instance->addCc($address, $name);
     }
     // Add bcc addresses
     foreach ($bcc as $address => $name) {
         $instance->addBcc($address, $name);
     }
     // Add reply to addresses
     foreach ($replyTo as $address => $name) {
         $instance->addReplyTo($address, $name);
     }
 }
开发者ID:vigourouxjulien,项目名称:thelia,代码行数:31,代码来源:MailerFactory.php

示例3: addReplyTo

 /**
  * {@inheritdoc}
  *
  * @return $this|self
  */
 public function addReplyTo($address, $name = null) : self
 {
     $this->message->addReplyTo($address, $name);
     return $this;
 }
开发者ID:cawaphp,项目名称:email,代码行数:10,代码来源:Message.php

示例4: getValid

 /**
  * @return \Swift_Message
  */
 public static function getValid()
 {
     $message = new \Swift_Message();
     $message->setFrom(MailWrapperTestBootstrap::$from);
     $message->addTo(MailWrapperTestBootstrap::$toAddresses[0]);
     $message->addTo(MailWrapperTestBootstrap::$toAddresses[1]);
     $message->addCC(MailWrapperTestBootstrap::$ccAddresses[0]);
     $message->addCC(MailWrapperTestBootstrap::$ccAddresses[1]);
     $message->addBCC(MailWrapperTestBootstrap::$bccAddresses[0]);
     $message->addBCC(MailWrapperTestBootstrap::$bccAddresses[1]);
     $message->addReplyTo(MailWrapperTestBootstrap::$alternate);
     $message->setSubject(MailWrapperTestBootstrap::$subject);
     $message->setBody(MailWrapperTestBootstrap::$contentText);
     $message->addPart(MailWrapperTestBootstrap::$contentHtml, 'text/html');
     return $message;
 }
开发者ID:BespokeSupport,项目名称:MailWrapper,代码行数:19,代码来源:TesterMessageSwift.php


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