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

PHP Mail\Message类代码示例

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

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



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

示例1: createMessage

 protected function createMessage()
 {
     $message = new Message(new Swift_Message());
     // If a global from address has been specified we will set it on every message
     // instances so the developer does not have to repeat themselves every time
     // they create a new message. We will just go ahead and push the address.
     if (isset($this->from['address'])) {
         $message->from($this->from['address'], $this->from['name']);
     }
     return $message;
 }
开发者ID:anekdotes,项目名称:mailer,代码行数:11,代码来源:SwiftMailerAdapter.php


示例2: testGetAttachments

 public function testGetAttachments()
 {
     $getAttachment = \Closure::bind(function ($message) {
         return $this->getAttachments($message);
     }, $this->transport, 'Sichikawa\\LaravelSendgridDriver\\Transport\\SendgridTransport');
     $message = new Message($this->getMessage());
     $file = __DIR__ . '/test.png';
     $message->attach($file);
     $res = $getAttachment($message->getSwiftMessage());
     $this->assertEquals(base64_encode(file_get_contents($file)), array_get($res, '0.content'));
     $this->assertEquals('test.png', array_get($res, '0.filename'));
 }
开发者ID:s-ichikawa,项目名称:laravel-sendgrid-driver-v3,代码行数:12,代码来源:SendgridTransportTest.php


示例3: __construct

 /**
  * Create a new message instance.
  *
  * @param  \Swift_Message  $swift
  * @return void
  */
 public function __construct(Swift_Message $swift, ViewFactory $viewFactory, Filesystem $filesystem, Translator $translator)
 {
     parent::__construct($swift);
     $this->viewFactory = $viewFactory;
     $this->filesystem = $filesystem;
     $this->translator = $translator;
     $this->data = [];
 }
开发者ID:SerdarSanri,项目名称:mailman,代码行数:14,代码来源:Message.php


示例4: addContent

 /**
  * Add the content to a given message.
  *
  * @param  \Illuminate\Mail\Message  $message
  * @param  string  $view
  * @param  string  $plain
  * @param  array   $data
  * @return void
  */
 protected function addContent($message, $view, $plain, $data)
 {
     if (isset($view)) {
         $viewContent = $this->getView($view, $data);
         $result = MailParser::parse($viewContent);
         $message->setBody($result['html'], 'text/html');
         if ($result['text']) {
             $message->addPart($result['text'], 'text/plain');
         }
         if ($subject = array_get($result['settings'], 'subject')) {
             $message->subject($subject);
         }
     }
     if (isset($plain)) {
         $message->addPart($this->getView($plain, $data), 'text/plain');
     }
 }
开发者ID:tamboer,项目名称:LaravelOctober,代码行数:26,代码来源:Mailer.php


示例5: createMessage

 /**
  * Create a new message instance.
  *
  * @return \Illuminate\Mail\Message
  */
 protected function createMessage()
 {
     // Get the DKIM selector.
     $selector = Config::get('mail.dkim.selector');
     // If we have a DKIM selector, then add the signing.
     if (!empty($selector)) {
         // Use the signed message with support for signing.
         // So long as there is a selector we will do this, even if a private
         // key is not set. This is handy if the application wants to add its
         // own signatures later.
         $message = new Message(new Swift_SignedMessage());
         // Get the key and domain name.
         // Ideally these would be specific to the selector, with the selector being
         // chosen according to the domain of the sending address. At this stage we do
         // not know what the final sending addressis going to be.
         $private_key = Config::get('mail.dkim.private_key');
         $domain_name = Config::get('mail.dkim.domain_name');
         if (!empty($private_key) && !empty($domain_name)) {
             // Do the DKIM signing.
             $dkim_signer = new Swift_Signers_DKIMSigner($private_key, $domain_name, $selector);
             // Issue #1: ignore certain headers that cause end-to-end failure.
             $dkim_signer->ignoreHeader('Return-Path');
             $dkim_signer->ignoreHeader('Bcc');
             $dkim_signer->ignoreHeader('DKIM-Signature');
             $dkim_signer->ignoreHeader('Received');
             $dkim_signer->ignoreHeader('Comments');
             $dkim_signer->ignoreHeader('Keywords');
             $dkim_signer->ignoreHeader('Resent-Bcc');
             $message->attachSigner($dkim_signer);
         }
     } else {
         // Non-signed message.
         $message = new Message(new Swift_Message());
     }
     // If a global from address has been specified we will set it on every message
     // instances so the developer does not have to repeat themselves every time
     // they create a new message. We will just go ahead and push the address.
     if (isset($this->from['address'])) {
         $message->from($this->from['address'], $this->from['name']);
     }
     return $message;
 }
开发者ID:academe,项目名称:laraveldkim,代码行数:47,代码来源:Mailer.php


示例6: addAddresses

 /**
  * Parse e-mail or array with e-mail addresses.
  *
  * @param array|string $address
  * @param string $name
  * @param string $type
  * @return \Illuminate\Mail\Message
  */
 protected function addAddresses($address, $name, $type)
 {
     if ('replyto' === strtolower($type)) {
         return parent::addAddresses($address, $name, $type);
     }
     if (is_array($address)) {
         $address = $this->validateArrayEmails($address);
     } else {
         $address = $this->validateEmail($address);
     }
     return parent::addAddresses($address, $name, $type);
 }
开发者ID:desmart,项目名称:laravel-mailer,代码行数:20,代码来源:Message.php


示例7: sendClosure

 protected function sendClosure(Message $mailObject)
 {
     $mailObject->subject($this->subject);
     $mailObject->from($this->from[0]['address'], $this->from[0]['name']);
     foreach ($this->to as $toDetails) {
         $mailObject->to($toDetails['address'], $toDetails['name']);
     }
     foreach ($this->cc as $ccDetails) {
         $mailObject->cc($ccDetails['address'], $ccDetails['name']);
     }
     foreach ($this->bcc as $bccDetails) {
         $mailObject->bcc($bccDetails['address'], $bccDetails['name']);
     }
     foreach ($this->attachments as $attachmentDetails) {
         $mailObject->attach($attachmentDetails['file'], ['as' => $attachmentDetails['filename'], 'mime' => $attachmentDetails['mimetype']]);
     }
 }
开发者ID:vultuk,项目名称:MailAwesome,代码行数:17,代码来源:MailAwesome.php


示例8: getIlluminateEmails

 /**
  * Builds the email array and return it as an array of all emails to be sent!!
  */
 public function getIlluminateEmails()
 {
     $emails = [];
     foreach ($this->tos as $destination) {
         $mail = new Message(new Swift_Message());
         $mail->to($destination[0], $destination[1]);
         $mail->from($this->from['email'], $this->from['name']);
         $mail->subject($this->subject);
         $mail->setBody($this->body['content'], $this->body['type']);
         foreach ($this->files as $file) {
             $mail->attach($file);
         }
         $emails[] = $mail;
     }
     return $emails;
 }
开发者ID:anekdotes,项目名称:mailer,代码行数:19,代码来源:MailTrapEmailAdapter.php


示例9: addContent

 /**
  * Add the content to a given message.
  *
  * @param  \Illuminate\Mail\Message  $message
  * @param  string  $view
  * @param  string  $plain
  * @param  string  $raw
  * @param  array  $data
  * @return void
  */
 protected function addContent($message, $view, $plain, $raw, $data)
 {
     if (isset($view)) {
         $message->setBody($this->getView($view, $data), 'text/html');
     }
     if (isset($plain)) {
         $method = isset($view) ? 'addPart' : 'setBody';
         $message->{$method}($this->getView($plain, $data), 'text/plain');
     }
     if (isset($raw)) {
         $method = isset($view) || isset($plain) ? 'addPart' : 'setBody';
         $message->{$method}($raw, 'text/plain');
     }
 }
开发者ID:bryanashley,项目名称:framework,代码行数:24,代码来源:Mailer.php


示例10: generateMessage

 /**
  * Generates a \Illuminate\Mail\Message template ready to send
  *
  * @param array $args = []
  * @return $this
  */
 public function generateMessage($args = [])
 {
     if (!empty($args)) {
         foreach ($args as $att => $v) {
             if (array_key_exists($att, get_object_vars($this))) {
                 $this->{$att} = $v;
             }
         }
     }
     $msg = new Message(new \Swift_Message());
     if ($this->hasFrom()) {
         $from = $this->getFrom();
         $msg->from($from[0], $from[1]);
     }
     if ($this->hasSender()) {
         $sender = $this->getSender();
         $msg->sender($sender[0], $sender[1]);
     }
     if ($this->hasTo()) {
         $to = $this->getTo();
         $msg->to($to[0], $to[1]);
     }
     if ($this->hasCc()) {
         $cc = $this->getCc();
         $msg->cc($cc[0], $cc[1]);
     }
     if ($this->hasBcc()) {
         $bcc = $this->getBcc();
         $msg->bcc($bcc[0], $bcc[1]);
     }
     if ($this->hasReplyTo()) {
         $reply_to = $this->getReplyTo();
         $msg->replyTo($reply_to[0], $reply_to[1]);
     }
     if ($this->hasSubject()) {
         $msg->subject($this->getSubject());
     }
     if ($this->hasAttach()) {
         foreach ($this->getAttach() as $attach) {
             $msg->attachData($attach[0], $attach[1], $attach[2]);
         }
     }
     if ($this->hasPriority()) {
         $msg->priority($this->getPriority());
     }
     $this->setMessage($msg);
     return $this;
 }
开发者ID:frenchfrogs,项目名称:mail,代码行数:54,代码来源:Mail.php


示例11: addContentRaw

 /**
  * Add the raw content to a given message.
  *
  * @param  \Illuminate\Mail\Message  $message
  * @param  string  $html
  * @param  string  $text
  * @return void
  */
 protected function addContentRaw($message, $html, $text)
 {
     if (isset($html)) {
         $message->setBody($html, 'text/html');
     }
     if (isset($text)) {
         $message->addPart($text, 'text/plain');
     }
 }
开发者ID:nevinsm,项目名称:personalSite,代码行数:17,代码来源:Mailer.php


示例12: recuperaAccesoMessage

 /**
  * CLOUSURE.
  *
  * Éste metodo es invocado desde la función Password::remind():
  *
  * Establece el asunto del mensaje que será enviado al usuario despúes de
  * solicitar la recuperación de su contraseña de acceso.
  *
  * @access protected
  * @param  Illuminate\Mail\Message  $message
  * @return void
  */
 protected function recuperaAccesoMessage(\Illuminate\Mail\Message $message)
 {
     $message->subject('Restaura tu contraseña de acceso.');
 }
开发者ID:egalink,项目名称:proveedores,代码行数:16,代码来源:UsuarioController.php


示例13: addAttachments

 /**
  * Add the attachments to the message.
  *
  * @param  \Illuminate\Mail\Message  $mailMessage
  * @param  \Illuminate\Notifications\Messages\MailMessage  $message
  * @return void
  */
 protected function addAttachments($mailMessage, $message)
 {
     foreach ($message->attachments as $attachment) {
         $mailMessage->attach($attachment['file'], $attachment['options']);
     }
     foreach ($message->rawAttachments as $attachment) {
         $mailMessage->attachData($attachment['data'], $attachment['name'], $attachment['options']);
     }
 }
开发者ID:jarnovanleeuwen,项目名称:framework,代码行数:16,代码来源:MailChannel.php


示例14: testSetPersonalizations

 public function testSetPersonalizations()
 {
     $setParameters = \Closure::bind(function ($message, $data) {
         return $this->setParameters($message, $data);
     }, $this->transport, SendgridV3Transport::class);
     $personalizations = [['substitutions' => ['substitutions_key' => 'substitutions_value'], 'custom_args' => ['custom_args_key' => 'custom_args_value'], 'send_at' => time()]];
     $message = new Message($this->getMessage());
     $message->embedData(['personalizations' => $personalizations], 'sendgrid/x-smtpapi');
     $data = [];
     $data = $setParameters($message->getSwiftMessage(), $data);
     $this->assertEquals(['personalizations' => $personalizations], $data);
 }
开发者ID:s-ichikawa,项目名称:laravel-sendgrid-driver,代码行数:12,代码来源:SendgridV3TransportTest.php


示例15: testSetSmtpApi

 public function testSetSmtpApi()
 {
     $setSmtpApi = \Closure::bind(function (&$data, $message) {
         return $this->setSmtpApi($data, $message);
     }, $this->transport, 'Sichikawa\\LaravelSendgridDriver\\Transport\\SendGridTransport');
     $data = [];
     $message = new Message($this->getMessage());
     $message->embedData(['category' => 'foo'], 'sendgrid/x-smtpapi');
     $setSmtpApi($data, $message->getSwiftMessage());
     $this->assertEquals(json_encode(['category' => 'foo']), $data['x-smtpapi']);
 }
开发者ID:alexdeoliveira,项目名称:laravel-sendgrid-driver,代码行数:11,代码来源:SendgridTransportTest.php


示例16: runCallbacks

 /**
  * Run the callbacks for the message.
  *
  * @param  \Illuminate\Mail\Message  $message
  * @return $this
  */
 protected function runCallbacks($message)
 {
     foreach ($this->callbacks as $callback) {
         $callback($message->getSwiftMessage());
     }
     return $this;
 }
开发者ID:scrubmx,项目名称:framework,代码行数:13,代码来源:Mailable.php


示例17: setSubject

 /**
  * Sets tzhe subject of the message
  *
  * @param \Illuminate\Mail\Message $message
  * @return void
  **/
 protected function setSubject(Message $message)
 {
     if (!isset($this->data['subject'])) {
         throw new OutOfBoundsException("You have to pass a subject key and value in your view data");
     }
     $message->subject($this->data['subject']);
 }
开发者ID:realholgi,项目名称:cmsable,代码行数:13,代码来源:MessageBuilder.php


示例18: addContent

 /**
  * Add the content to a given message.
  *
  * @param  \Illuminate\Mail\Message $message
  * @param  string $view
  * @param  string $plain
  * @param  array $data
  * @return void
  */
 protected function addContent($message, $view, $plain, $raw, $data)
 {
     /*
      * Extensbility
      */
     if ($this->fireEvent('mailer.beforeAddContent', [$message, $view, $data], true) === false || Event::fire('mailer.beforeAddContent', [$this, $message, $view, $data], true) === false) {
         return;
     }
     $html = null;
     $text = null;
     if (isset($view)) {
         $viewContent = $this->getView($view, $data);
         $result = MailParser::parse($viewContent);
         $html = $result['html'];
         if ($result['text']) {
             $text = $result['text'];
         }
         /*
          * Subject
          */
         $customSubject = $message->getSwiftMessage()->getSubject();
         if (empty($customSubject) && ($subject = array_get($result['settings'], 'subject'))) {
             $message->subject($subject);
         }
     }
     if (isset($plain)) {
         $text = $this->getView($plain, $data);
     }
     if (isset($raw)) {
         $text = $raw;
     }
     $this->addContentRaw($message, $html, $text);
     /*
      * Extensbility
      */
     $this->fireEvent('mailer.addContent', [$message, $view, $data]);
     Event::fire('mailer.addContent', [$this, $message, $view, $data]);
 }
开发者ID:betes-curieuses-design,项目名称:ElieJosiePhotographie,代码行数:47,代码来源:Mailer.php


示例19: addContent

 /**
  * Add the content to a given message.
  *
  * @param  \Illuminate\Mail\Message $message
  * @param  string $view
  * @param  string $plain
  * @param  array $data
  * @return void
  */
 protected function addContent($message, $view, $plain, $raw, $data)
 {
     /*
      * Extensbility
      */
     if ($this->fireEvent('mailer.beforeAddContent', [$message, $view, $data], true) === false || Event::fire('mailer.beforeAddContent', [$this, $message, $view, $data], true) === false) {
         return;
     }
     if (isset($view)) {
         $viewContent = $this->getView($view, $data);
         $result = MailParser::parse($viewContent);
         $message->setBody($result['html'], 'text/html');
         if ($result['text']) {
             $message->addPart($result['text'], 'text/plain');
         }
         if ($subject = array_get($result['settings'], 'subject')) {
             $message->subject($subject);
         }
     }
     if (isset($plain)) {
         $message->addPart($this->getView($plain, $data), 'text/plain');
     }
     if (isset($raw)) {
         $message->addPart($raw, 'text/plain');
     }
     /*
      * Extensbility
      */
     $this->fireEvent('mailer.addContent', [$message, $view, $data]);
     Event::fire('mailer.addContent', [$this, $message, $view, $data]);
 }
开发者ID:janusnic,项目名称:23copperleaf,代码行数:40,代码来源:Mailer.php


示例20: buildInvoiceMessage

 /**
  * Build the invoice notification message.
  *
  * @param  \Illuminate\Mail\Message  $message
  * @param  mixed  $billable
  * @param  \Laravel\Cashier\Invoice
  * @param  array  $invoiceData
  * @return void
  */
 protected function buildInvoiceMessage($message, $billable, $invoice, array $invoiceData)
 {
     $message->to($billable->email, $billable->name)->subject($invoiceData['product'] . ' Invoice')->attachData($invoice->pdf($invoiceData), 'invoice.pdf');
 }
开发者ID:defenestrator,项目名称:groid,代码行数:13,代码来源:SendsInvoiceNotifications.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP Pagination\Factory类代码示例发布时间:2022-05-23
下一篇:
PHP Mail\Mailer类代码示例发布时间: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