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


PHP Mailgun::MessageBuilder方法代码示例

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


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

示例1: later

 /**
  * @param int|array|\DateTime|Carbon $time
  * @param string|array               $view
  * @param array                      $data
  * @param \Closure                   $callback
  *
  * @return \Bogardo\Mailgun\Http\Response
  */
 public function later($time, $view, array $data, Closure $callback)
 {
     $message = new Message($this->mailgun->MessageBuilder(), $this->config);
     $message->builder()->setDeliveryTime($this->parseTime($time), $this->config->get('app.timezone', 'UTC'));
     return $this->send($view, $data, $callback, $message);
 }
开发者ID:bogardo,项目名称:mailgun,代码行数:14,代码来源:Mailer.php

示例2: transportMailMailgun

 /**
  * Transport mail message with mailgun services
  *
  * @param $to
  * @param $subj
  * @param $body
  * @param $hash
  * @param $intro
  * @param $options
  *
  * @return bool
  */
 public static function transportMailMailgun($to, $subj, $body, $hash, $intro, $options)
 {
     // @TODO make sure that from and reply-to addresses are correctly set in headers
     if (!is_array($to)) {
         $to = explode(',', $to);
     }
     $signature = Util::lavnn('signature', $options, 'team');
     $language = Util::lavnn('language', $options, 'en');
     $sender = Util::lavnn('sender', $options, 0);
     $config = Config::getInstance();
     # Instantiate the client.
     $mgClient = new Mailgun($config->get('mailgun.apiKey'));
     $domain = $config->get('mailgun.domain');
     $msgBuilder = $mgClient->MessageBuilder();
     $from = $config->get('mailgun.from');
     if ($signature != 'team' && $sender > 0) {
         $userModel = new User();
         if ($userModel->load($sender)->isValid()) {
             $from = $userModel->get('fname') . ' ' . $userModel->get('lname') . ' <' . $userModel->get('email') . '>';
         }
     }
     $msgBuilder->setFromAddress($from);
     foreach ($to as $recipient) {
         $msgBuilder->addToRecipient(trim($recipient));
     }
     $msgBuilder->setSubject($subj);
     $msgBuilder->setTextBody(self::prepareTextMail($subj, $body, $hash, $intro, $signature, $language, $sender));
     $msgBuilder->setHtmlBody(self::prepareHtmlMail($subj, $body, $hash, $intro, $signature, $language, $sender));
     $result = $mgClient->post("{$domain}/messages", $msgBuilder->getMessage(), $msgBuilder->getFiles());
     return $result->http_response_code == 200;
 }
开发者ID:barcodex,项目名称:kasha-mail,代码行数:43,代码来源:MailUtil.php


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