Pressroom template verwijderd, website naar root van repo
This commit is contained in:
24
vendor/laravel/framework/src/Illuminate/Mail/Events/MessageSending.php
vendored
Normal file
24
vendor/laravel/framework/src/Illuminate/Mail/Events/MessageSending.php
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Mail\Events;
|
||||
|
||||
class MessageSending
|
||||
{
|
||||
/**
|
||||
* The Swift message instance.
|
||||
*
|
||||
* @var \Swift_Message
|
||||
*/
|
||||
public $message;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @param \Swift_Message $message
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($message)
|
||||
{
|
||||
$this->message = $message;
|
||||
}
|
||||
}
|
||||
24
vendor/laravel/framework/src/Illuminate/Mail/Events/MessageSent.php
vendored
Normal file
24
vendor/laravel/framework/src/Illuminate/Mail/Events/MessageSent.php
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Mail\Events;
|
||||
|
||||
class MessageSent
|
||||
{
|
||||
/**
|
||||
* The Swift message instance.
|
||||
*
|
||||
* @var \Swift_Message
|
||||
*/
|
||||
public $message;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @param \Swift_Message $message
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($message)
|
||||
{
|
||||
$this->message = $message;
|
||||
}
|
||||
}
|
||||
145
vendor/laravel/framework/src/Illuminate/Mail/MailServiceProvider.php
vendored
Executable file
145
vendor/laravel/framework/src/Illuminate/Mail/MailServiceProvider.php
vendored
Executable file
@@ -0,0 +1,145 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Mail;
|
||||
|
||||
use Swift_Mailer;
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class MailServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Indicates if loading of the provider is deferred.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected $defer = true;
|
||||
|
||||
/**
|
||||
* Register the service provider.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
$this->registerSwiftMailer();
|
||||
|
||||
$this->registerIlluminateMailer();
|
||||
|
||||
$this->registerMarkdownRenderer();
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the Illuminate mailer instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function registerIlluminateMailer()
|
||||
{
|
||||
$this->app->singleton('mailer', function ($app) {
|
||||
$config = $app->make('config')->get('mail');
|
||||
|
||||
// Once we have create the mailer instance, we will set a container instance
|
||||
// on the mailer. This allows us to resolve mailer classes via containers
|
||||
// for maximum testability on said classes instead of passing Closures.
|
||||
$mailer = new Mailer(
|
||||
$app['view'], $app['swift.mailer'], $app['events']
|
||||
);
|
||||
|
||||
if ($app->bound('queue')) {
|
||||
$mailer->setQueue($app['queue']);
|
||||
}
|
||||
|
||||
// Next we will set all of the global addresses on this mailer, which allows
|
||||
// for easy unification of all "from" addresses as well as easy debugging
|
||||
// of sent messages since they get be sent into a single email address.
|
||||
foreach (['from', 'reply_to', 'to'] as $type) {
|
||||
$this->setGlobalAddress($mailer, $config, $type);
|
||||
}
|
||||
|
||||
return $mailer;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a global address on the mailer by type.
|
||||
*
|
||||
* @param \Illuminate\Mail\Mailer $mailer
|
||||
* @param array $config
|
||||
* @param string $type
|
||||
* @return void
|
||||
*/
|
||||
protected function setGlobalAddress($mailer, array $config, $type)
|
||||
{
|
||||
$address = Arr::get($config, $type);
|
||||
|
||||
if (is_array($address) && isset($address['address'])) {
|
||||
$mailer->{'always'.Str::studly($type)}($address['address'], $address['name']);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the Swift Mailer instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function registerSwiftMailer()
|
||||
{
|
||||
$this->registerSwiftTransport();
|
||||
|
||||
// Once we have the transporter registered, we will register the actual Swift
|
||||
// mailer instance, passing in the transport instances, which allows us to
|
||||
// override this transporter instances during app start-up if necessary.
|
||||
$this->app->singleton('swift.mailer', function ($app) {
|
||||
return new Swift_Mailer($app['swift.transport']->driver());
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the Swift Transport instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function registerSwiftTransport()
|
||||
{
|
||||
$this->app->singleton('swift.transport', function ($app) {
|
||||
return new TransportManager($app);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the Markdown renderer instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function registerMarkdownRenderer()
|
||||
{
|
||||
if ($this->app->runningInConsole()) {
|
||||
$this->publishes([
|
||||
__DIR__.'/resources/views' => $this->app->resourcePath('views/vendor/mail'),
|
||||
], 'laravel-mail');
|
||||
}
|
||||
|
||||
$this->app->singleton(Markdown::class, function ($app) {
|
||||
$config = $app->make('config');
|
||||
|
||||
return new Markdown($app->make('view'), [
|
||||
'theme' => $config->get('mail.markdown.theme', 'default'),
|
||||
'paths' => $config->get('mail.markdown.paths', []),
|
||||
]);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the services provided by the provider.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function provides()
|
||||
{
|
||||
return [
|
||||
'mailer', 'swift.mailer', 'swift.transport', Markdown::class,
|
||||
];
|
||||
}
|
||||
}
|
||||
661
vendor/laravel/framework/src/Illuminate/Mail/Mailable.php
vendored
Normal file
661
vendor/laravel/framework/src/Illuminate/Mail/Mailable.php
vendored
Normal file
@@ -0,0 +1,661 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Mail;
|
||||
|
||||
use ReflectionClass;
|
||||
use ReflectionProperty;
|
||||
use BadMethodCallException;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Container\Container;
|
||||
use Illuminate\Contracts\Queue\Factory as Queue;
|
||||
use Illuminate\Contracts\Mail\Mailer as MailerContract;
|
||||
use Illuminate\Contracts\Mail\Mailable as MailableContract;
|
||||
|
||||
class Mailable implements MailableContract
|
||||
{
|
||||
/**
|
||||
* The person the message is from.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $from = [];
|
||||
|
||||
/**
|
||||
* The "to" recipients of the message.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $to = [];
|
||||
|
||||
/**
|
||||
* The "cc" recipients of the message.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $cc = [];
|
||||
|
||||
/**
|
||||
* The "bcc" recipients of the message.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $bcc = [];
|
||||
|
||||
/**
|
||||
* The "reply to" recipients of the message.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $replyTo = [];
|
||||
|
||||
/**
|
||||
* The subject of the message.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $subject;
|
||||
|
||||
/**
|
||||
* The Markdown template for the message (if applicable).
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $markdown;
|
||||
|
||||
/**
|
||||
* The view to use for the message.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $view;
|
||||
|
||||
/**
|
||||
* The plain text view to use for the message.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $textView;
|
||||
|
||||
/**
|
||||
* The view data for the message.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $viewData = [];
|
||||
|
||||
/**
|
||||
* The attachments for the message.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $attachments = [];
|
||||
|
||||
/**
|
||||
* The raw attachments for the message.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $rawAttachments = [];
|
||||
|
||||
/**
|
||||
* The callbacks for the message.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $callbacks = [];
|
||||
|
||||
/**
|
||||
* Send the message using the given mailer.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Mail\Mailer $mailer
|
||||
* @return void
|
||||
*/
|
||||
public function send(MailerContract $mailer)
|
||||
{
|
||||
Container::getInstance()->call([$this, 'build']);
|
||||
|
||||
$mailer->send($this->buildView(), $this->buildViewData(), function ($message) {
|
||||
$this->buildFrom($message)
|
||||
->buildRecipients($message)
|
||||
->buildSubject($message)
|
||||
->buildAttachments($message)
|
||||
->runCallbacks($message);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Queue the message for sending.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Queue\Factory $queue
|
||||
* @return mixed
|
||||
*/
|
||||
public function queue(Queue $queue)
|
||||
{
|
||||
$connection = property_exists($this, 'connection') ? $this->connection : null;
|
||||
|
||||
$queueName = property_exists($this, 'queue') ? $this->queue : null;
|
||||
|
||||
return $queue->connection($connection)->pushOn(
|
||||
$queueName ?: null, new SendQueuedMailable($this)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deliver the queued message after the given delay.
|
||||
*
|
||||
* @param \DateTime|int $delay
|
||||
* @param Queue $queue
|
||||
* @return mixed
|
||||
*/
|
||||
public function later($delay, Queue $queue)
|
||||
{
|
||||
$connection = property_exists($this, 'connection') ? $this->connection : null;
|
||||
|
||||
$queueName = property_exists($this, 'queue') ? $this->queue : null;
|
||||
|
||||
return $queue->connection($connection)->laterOn(
|
||||
$queueName ?: null, $delay, new SendQueuedMailable($this)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the view for the message.
|
||||
*
|
||||
* @return array|string
|
||||
*/
|
||||
protected function buildView()
|
||||
{
|
||||
if (isset($this->markdown)) {
|
||||
return $this->buildMarkdownView();
|
||||
}
|
||||
|
||||
if (isset($this->view, $this->textView)) {
|
||||
return [$this->view, $this->textView];
|
||||
} elseif (isset($this->textView)) {
|
||||
return ['text' => $this->textView];
|
||||
}
|
||||
|
||||
return $this->view;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the Markdown view for the message.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function buildMarkdownView()
|
||||
{
|
||||
$markdown = Container::getInstance()->make(Markdown::class);
|
||||
|
||||
$data = $this->buildViewData();
|
||||
|
||||
return [
|
||||
'html' => $markdown->render($this->markdown, $data),
|
||||
'text' => $this->buildMarkdownText($markdown, $data),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the view data for the message.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function buildViewData()
|
||||
{
|
||||
$data = $this->viewData;
|
||||
|
||||
foreach ((new ReflectionClass($this))->getProperties(ReflectionProperty::IS_PUBLIC) as $property) {
|
||||
if ($property->getDeclaringClass()->getName() != self::class) {
|
||||
$data[$property->getName()] = $property->getValue($this);
|
||||
}
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the text view for a Markdown message.
|
||||
*
|
||||
* @param \Illuminate\Mail\Markdown $markdown
|
||||
* @param array $data
|
||||
* @return string
|
||||
*/
|
||||
protected function buildMarkdownText($markdown, $data)
|
||||
{
|
||||
return isset($this->textView)
|
||||
? $this->textView
|
||||
: $markdown->renderText($this->markdown, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the sender to the message.
|
||||
*
|
||||
* @param \Illuminate\Mail\Message $message
|
||||
* @return $this
|
||||
*/
|
||||
protected function buildFrom($message)
|
||||
{
|
||||
if (! empty($this->from)) {
|
||||
$message->from($this->from[0]['address'], $this->from[0]['name']);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add all of the recipients to the message.
|
||||
*
|
||||
* @param \Illuminate\Mail\Message $message
|
||||
* @return $this
|
||||
*/
|
||||
protected function buildRecipients($message)
|
||||
{
|
||||
foreach (['to', 'cc', 'bcc', 'replyTo'] as $type) {
|
||||
foreach ($this->{$type} as $recipient) {
|
||||
$message->{$type}($recipient['address'], $recipient['name']);
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the subject for the message.
|
||||
*
|
||||
* @param \Illuminate\Mail\Message $message
|
||||
* @return $this
|
||||
*/
|
||||
protected function buildSubject($message)
|
||||
{
|
||||
if ($this->subject) {
|
||||
$message->subject($this->subject);
|
||||
} else {
|
||||
$message->subject(Str::title(Str::snake(class_basename($this), ' ')));
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add all of the attachments to the message.
|
||||
*
|
||||
* @param \Illuminate\Mail\Message $message
|
||||
* @return $this
|
||||
*/
|
||||
protected function buildAttachments($message)
|
||||
{
|
||||
foreach ($this->attachments as $attachment) {
|
||||
$message->attach($attachment['file'], $attachment['options']);
|
||||
}
|
||||
|
||||
foreach ($this->rawAttachments as $attachment) {
|
||||
$message->attachData(
|
||||
$attachment['data'], $attachment['name'], $attachment['options']
|
||||
);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the priority of this message.
|
||||
*
|
||||
* The value is an integer where 1 is the highest priority and 5 is the lowest.
|
||||
*
|
||||
* @param int $level
|
||||
* @return $this
|
||||
*/
|
||||
public function priority($level = 3)
|
||||
{
|
||||
$this->callbacks[] = function ($message) use ($level) {
|
||||
$message->setPriority($level);
|
||||
};
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the sender of the message.
|
||||
*
|
||||
* @param object|array|string $address
|
||||
* @param string|null $name
|
||||
* @return $this
|
||||
*/
|
||||
public function from($address, $name = null)
|
||||
{
|
||||
return $this->setAddress($address, $name, 'from');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the given recipient is set on the mailable.
|
||||
*
|
||||
* @param object|array|string $address
|
||||
* @param string|null $name
|
||||
* @return bool
|
||||
*/
|
||||
public function hasFrom($address, $name = null)
|
||||
{
|
||||
return $this->hasRecipient($address, $name, 'from');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the recipients of the message.
|
||||
*
|
||||
* @param object|array|string $address
|
||||
* @param string|null $name
|
||||
* @return $this
|
||||
*/
|
||||
public function to($address, $name = null)
|
||||
{
|
||||
return $this->setAddress($address, $name, 'to');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the given recipient is set on the mailable.
|
||||
*
|
||||
* @param object|array|string $address
|
||||
* @param string|null $name
|
||||
* @return bool
|
||||
*/
|
||||
public function hasTo($address, $name = null)
|
||||
{
|
||||
return $this->hasRecipient($address, $name, 'to');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the recipients of the message.
|
||||
*
|
||||
* @param object|array|string $address
|
||||
* @param string|null $name
|
||||
* @return $this
|
||||
*/
|
||||
public function cc($address, $name = null)
|
||||
{
|
||||
return $this->setAddress($address, $name, 'cc');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the given recipient is set on the mailable.
|
||||
*
|
||||
* @param object|array|string $address
|
||||
* @param string|null $name
|
||||
* @return bool
|
||||
*/
|
||||
public function hasCc($address, $name = null)
|
||||
{
|
||||
return $this->hasRecipient($address, $name, 'cc');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the recipients of the message.
|
||||
*
|
||||
* @param object|array|string $address
|
||||
* @param string|null $name
|
||||
* @return $this
|
||||
*/
|
||||
public function bcc($address, $name = null)
|
||||
{
|
||||
return $this->setAddress($address, $name, 'bcc');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the given recipient is set on the mailable.
|
||||
*
|
||||
* @param object|array|string $address
|
||||
* @param string|null $name
|
||||
* @return bool
|
||||
*/
|
||||
public function hasBcc($address, $name = null)
|
||||
{
|
||||
return $this->hasRecipient($address, $name, 'bcc');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the "reply to" address of the message.
|
||||
*
|
||||
* @param object|array|string $address
|
||||
* @param string|null $name
|
||||
* @return $this
|
||||
*/
|
||||
public function replyTo($address, $name = null)
|
||||
{
|
||||
return $this->setAddress($address, $name, 'replyTo');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the recipients of the message.
|
||||
*
|
||||
* All recipients are stored internally as [['name' => ?, 'address' => ?]]
|
||||
*
|
||||
* @param object|array|string $address
|
||||
* @param string|null $name
|
||||
* @param string $property
|
||||
* @return $this
|
||||
*/
|
||||
protected function setAddress($address, $name = null, $property = 'to')
|
||||
{
|
||||
foreach ($this->addressesToArray($address, $name) as $recipient) {
|
||||
$recipient = $this->normalizeRecipient($recipient);
|
||||
|
||||
$this->{$property}[] = [
|
||||
'name' => isset($recipient->name) ? $recipient->name : null,
|
||||
'address' => $recipient->email,
|
||||
];
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the given recipient arguments to an array.
|
||||
*
|
||||
* @param object|array|string $address
|
||||
* @param string|null $name
|
||||
* @return array
|
||||
*/
|
||||
protected function addressesToArray($address, $name)
|
||||
{
|
||||
if (! is_array($address) && ! $address instanceof Collection) {
|
||||
$address = is_string($name) ? [['name' => $name, 'email' => $address]] : [$address];
|
||||
}
|
||||
|
||||
return $address;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the given recipient into an object.
|
||||
*
|
||||
* @param mixed $recipient
|
||||
* @return object
|
||||
*/
|
||||
protected function normalizeRecipient($recipient)
|
||||
{
|
||||
if (is_array($recipient)) {
|
||||
return (object) $recipient;
|
||||
} elseif (is_string($recipient)) {
|
||||
return (object) ['email' => $recipient];
|
||||
}
|
||||
|
||||
return $recipient;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the given recipient is set on the mailable.
|
||||
*
|
||||
* @param object|array|string $address
|
||||
* @param string|null $name
|
||||
* @param string $property
|
||||
* @return bool
|
||||
*/
|
||||
protected function hasRecipient($address, $name = null, $property = 'to')
|
||||
{
|
||||
$expected = $this->normalizeRecipient(
|
||||
$this->addressesToArray($address, $name)[0]
|
||||
);
|
||||
|
||||
$expected = [
|
||||
'name' => isset($expected->name) ? $expected->name : null,
|
||||
'address' => $expected->email,
|
||||
];
|
||||
|
||||
return collect($this->{$property})->contains(function ($actual) use ($expected) {
|
||||
if (! isset($expected['name'])) {
|
||||
return $actual['address'] == $expected['address'];
|
||||
} else {
|
||||
return $actual == $expected;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the subject of the message.
|
||||
*
|
||||
* @param string $subject
|
||||
* @return $this
|
||||
*/
|
||||
public function subject($subject)
|
||||
{
|
||||
$this->subject = $subject;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the Markdown template for the message.
|
||||
*
|
||||
* @param string $view
|
||||
* @param array $data
|
||||
* @return $this
|
||||
*/
|
||||
public function markdown($view, array $data = [])
|
||||
{
|
||||
$this->markdown = $view;
|
||||
$this->viewData = array_merge($this->viewData, $data);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the view and view data for the message.
|
||||
*
|
||||
* @param string $view
|
||||
* @param array $data
|
||||
* @return $this
|
||||
*/
|
||||
public function view($view, array $data = [])
|
||||
{
|
||||
$this->view = $view;
|
||||
$this->viewData = array_merge($this->viewData, $data);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the plain text view for the message.
|
||||
*
|
||||
* @param string $textView
|
||||
* @param array $data
|
||||
* @return $this
|
||||
*/
|
||||
public function text($textView, array $data = [])
|
||||
{
|
||||
$this->textView = $textView;
|
||||
$this->viewData = array_merge($this->viewData, $data);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the view data for the message.
|
||||
*
|
||||
* @param string|array $key
|
||||
* @param mixed $value
|
||||
* @return $this
|
||||
*/
|
||||
public function with($key, $value = null)
|
||||
{
|
||||
if (is_array($key)) {
|
||||
$this->viewData = array_merge($this->viewData, $key);
|
||||
} else {
|
||||
$this->viewData[$key] = $value;
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Attach a file to the message.
|
||||
*
|
||||
* @param string $file
|
||||
* @param array $options
|
||||
* @return $this
|
||||
*/
|
||||
public function attach($file, array $options = [])
|
||||
{
|
||||
$this->attachments[] = compact('file', 'options');
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Attach in-memory data as an attachment.
|
||||
*
|
||||
* @param string $data
|
||||
* @param string $name
|
||||
* @param array $options
|
||||
* @return $this
|
||||
*/
|
||||
public function attachData($data, $name, array $options = [])
|
||||
{
|
||||
$this->rawAttachments[] = compact('data', 'name', 'options');
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a callback to be called with the Swift message instance.
|
||||
*
|
||||
* @param callable $callback
|
||||
* @return $this
|
||||
*/
|
||||
public function withSwiftMessage($callback)
|
||||
{
|
||||
$this->callbacks[] = $callback;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Dynamically bind parameters to the message.
|
||||
*
|
||||
* @param string $method
|
||||
* @param array $parameters
|
||||
* @return $this
|
||||
*
|
||||
* @throws \BadMethodCallException
|
||||
*/
|
||||
public function __call($method, $parameters)
|
||||
{
|
||||
if (Str::startsWith($method, 'with')) {
|
||||
return $this->with(Str::snake(substr($method, 4)), $parameters[0]);
|
||||
}
|
||||
|
||||
throw new BadMethodCallException("Method [$method] does not exist on mailable.");
|
||||
}
|
||||
}
|
||||
546
vendor/laravel/framework/src/Illuminate/Mail/Mailer.php
vendored
Executable file
546
vendor/laravel/framework/src/Illuminate/Mail/Mailer.php
vendored
Executable file
@@ -0,0 +1,546 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Mail;
|
||||
|
||||
use Swift_Mailer;
|
||||
use Illuminate\Support\Arr;
|
||||
use InvalidArgumentException;
|
||||
use Illuminate\Contracts\View\Factory;
|
||||
use Illuminate\Support\Traits\Macroable;
|
||||
use Illuminate\Contracts\Support\Htmlable;
|
||||
use Illuminate\Contracts\Events\Dispatcher;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Contracts\Mail\Mailer as MailerContract;
|
||||
use Illuminate\Contracts\Queue\Factory as QueueContract;
|
||||
use Illuminate\Contracts\Mail\Mailable as MailableContract;
|
||||
use Illuminate\Contracts\Mail\MailQueue as MailQueueContract;
|
||||
|
||||
class Mailer implements MailerContract, MailQueueContract
|
||||
{
|
||||
use Macroable;
|
||||
|
||||
/**
|
||||
* The view factory instance.
|
||||
*
|
||||
* @var \Illuminate\Contracts\View\Factory
|
||||
*/
|
||||
protected $views;
|
||||
|
||||
/**
|
||||
* The Swift Mailer instance.
|
||||
*
|
||||
* @var \Swift_Mailer
|
||||
*/
|
||||
protected $swift;
|
||||
|
||||
/**
|
||||
* The event dispatcher instance.
|
||||
*
|
||||
* @var \Illuminate\Contracts\Events\Dispatcher|null
|
||||
*/
|
||||
protected $events;
|
||||
|
||||
/**
|
||||
* The global from address and name.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $from;
|
||||
|
||||
/**
|
||||
* The global reply-to address and name.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $replyTo;
|
||||
|
||||
/**
|
||||
* The global to address and name.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $to;
|
||||
|
||||
/**
|
||||
* The queue implementation.
|
||||
*
|
||||
* @var \Illuminate\Contracts\Queue\Queue
|
||||
*/
|
||||
protected $queue;
|
||||
|
||||
/**
|
||||
* Array of failed recipients.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $failedRecipients = [];
|
||||
|
||||
/**
|
||||
* Create a new Mailer instance.
|
||||
*
|
||||
* @param \Illuminate\Contracts\View\Factory $views
|
||||
* @param \Swift_Mailer $swift
|
||||
* @param \Illuminate\Contracts\Events\Dispatcher|null $events
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Factory $views, Swift_Mailer $swift, Dispatcher $events = null)
|
||||
{
|
||||
$this->views = $views;
|
||||
$this->swift = $swift;
|
||||
$this->events = $events;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the global from address and name.
|
||||
*
|
||||
* @param string $address
|
||||
* @param string|null $name
|
||||
* @return void
|
||||
*/
|
||||
public function alwaysFrom($address, $name = null)
|
||||
{
|
||||
$this->from = compact('address', 'name');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the global reply-to address and name.
|
||||
*
|
||||
* @param string $address
|
||||
* @param string|null $name
|
||||
* @return void
|
||||
*/
|
||||
public function alwaysReplyTo($address, $name = null)
|
||||
{
|
||||
$this->replyTo = compact('address', 'name');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the global to address and name.
|
||||
*
|
||||
* @param string $address
|
||||
* @param string|null $name
|
||||
* @return void
|
||||
*/
|
||||
public function alwaysTo($address, $name = null)
|
||||
{
|
||||
$this->to = compact('address', 'name');
|
||||
}
|
||||
|
||||
/**
|
||||
* Begin the process of mailing a mailable class instance.
|
||||
*
|
||||
* @param mixed $users
|
||||
* @return \Illuminate\Mail\PendingMail
|
||||
*/
|
||||
public function to($users)
|
||||
{
|
||||
return (new PendingMail($this))->to($users);
|
||||
}
|
||||
|
||||
/**
|
||||
* Begin the process of mailing a mailable class instance.
|
||||
*
|
||||
* @param mixed $users
|
||||
* @return \Illuminate\Mail\PendingMail
|
||||
*/
|
||||
public function bcc($users)
|
||||
{
|
||||
return (new PendingMail($this))->bcc($users);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a new message when only a raw text part.
|
||||
*
|
||||
* @param string $text
|
||||
* @param mixed $callback
|
||||
* @return void
|
||||
*/
|
||||
public function raw($text, $callback)
|
||||
{
|
||||
return $this->send(['raw' => $text], [], $callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a new message when only a plain part.
|
||||
*
|
||||
* @param string $view
|
||||
* @param array $data
|
||||
* @param mixed $callback
|
||||
* @return void
|
||||
*/
|
||||
public function plain($view, array $data, $callback)
|
||||
{
|
||||
return $this->send(['text' => $view], $data, $callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a new message using a view.
|
||||
*
|
||||
* @param string|array $view
|
||||
* @param array $data
|
||||
* @param \Closure|string $callback
|
||||
* @return void
|
||||
*/
|
||||
public function send($view, array $data = [], $callback = null)
|
||||
{
|
||||
if ($view instanceof MailableContract) {
|
||||
return $this->sendMailable($view);
|
||||
}
|
||||
|
||||
// First we need to parse the view, which could either be a string or an array
|
||||
// containing both an HTML and plain text versions of the view which should
|
||||
// be used when sending an e-mail. We will extract both of them out here.
|
||||
list($view, $plain, $raw) = $this->parseView($view);
|
||||
|
||||
$data['message'] = $message = $this->createMessage();
|
||||
|
||||
// Once we have retrieved the view content for the e-mail we will set the body
|
||||
// of this message using the HTML type, which will provide a simple wrapper
|
||||
// to creating view based emails that are able to receive arrays of data.
|
||||
$this->addContent($message, $view, $plain, $raw, $data);
|
||||
|
||||
call_user_func($callback, $message);
|
||||
|
||||
// If a global "to" address has been set, we will set that address on the mail
|
||||
// message. This is primarily useful during local development in which each
|
||||
// message should be delivered into a single mail address for inspection.
|
||||
if (isset($this->to['address'])) {
|
||||
$this->setGlobalTo($message);
|
||||
}
|
||||
|
||||
// Next we will determine if the message should be send. We give the developer
|
||||
// one final chance to stop this message and then we will send it to all of
|
||||
// its recipients. We will then fire the sent event for the sent message.
|
||||
$swiftMessage = $message->getSwiftMessage();
|
||||
|
||||
if ($this->shouldSendMessage($swiftMessage)) {
|
||||
$this->sendSwiftMessage($swiftMessage);
|
||||
|
||||
$this->dispatchSentEvent($message);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Send the given mailable.
|
||||
*
|
||||
* @param MailableContract $mailable
|
||||
* @return mixed
|
||||
*/
|
||||
protected function sendMailable(MailableContract $mailable)
|
||||
{
|
||||
return $mailable instanceof ShouldQueue
|
||||
? $mailable->queue($this->queue) : $mailable->send($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the given view name or array.
|
||||
*
|
||||
* @param string|array $view
|
||||
* @return array
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
protected function parseView($view)
|
||||
{
|
||||
if (is_string($view)) {
|
||||
return [$view, null, null];
|
||||
}
|
||||
|
||||
// If the given view is an array with numeric keys, we will just assume that
|
||||
// both a "pretty" and "plain" view were provided, so we will return this
|
||||
// array as is, since must should contain both views with numeric keys.
|
||||
if (is_array($view) && isset($view[0])) {
|
||||
return [$view[0], $view[1], null];
|
||||
}
|
||||
|
||||
// If this view is an array but doesn't contain numeric keys, we will assume
|
||||
// the views are being explicitly specified and will extract them via the
|
||||
// named keys instead, allowing the developers to use one or the other.
|
||||
if (is_array($view)) {
|
||||
return [
|
||||
Arr::get($view, 'html'),
|
||||
Arr::get($view, 'text'),
|
||||
Arr::get($view, 'raw'),
|
||||
];
|
||||
}
|
||||
|
||||
throw new InvalidArgumentException('Invalid view.');
|
||||
}
|
||||
|
||||
/**
|
||||
* 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->renderView($view, $data), 'text/html');
|
||||
}
|
||||
|
||||
if (isset($plain)) {
|
||||
$method = isset($view) ? 'addPart' : 'setBody';
|
||||
|
||||
$message->$method($this->renderView($plain, $data), 'text/plain');
|
||||
}
|
||||
|
||||
if (isset($raw)) {
|
||||
$method = (isset($view) || isset($plain)) ? 'addPart' : 'setBody';
|
||||
|
||||
$message->$method($raw, 'text/plain');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the given view.
|
||||
*
|
||||
* @param string $view
|
||||
* @param array $data
|
||||
* @return string
|
||||
*/
|
||||
protected function renderView($view, $data)
|
||||
{
|
||||
return $view instanceof Htmlable
|
||||
? $view->toHtml()
|
||||
: $this->views->make($view, $data)->render();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the global "to" address on the given message.
|
||||
*
|
||||
* @param \Illuminate\Mail\Message $message
|
||||
* @return void
|
||||
*/
|
||||
protected function setGlobalTo($message)
|
||||
{
|
||||
$message->to($this->to['address'], $this->to['name'], true);
|
||||
$message->cc($this->to['address'], $this->to['name'], true);
|
||||
$message->bcc($this->to['address'], $this->to['name'], true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Queue a new e-mail message for sending.
|
||||
*
|
||||
* @param string|array $view
|
||||
* @param array $data
|
||||
* @param \Closure|string $callback
|
||||
* @param string|null $queue
|
||||
* @return mixed
|
||||
*/
|
||||
public function queue($view, array $data = [], $callback = null, $queue = null)
|
||||
{
|
||||
if (! $view instanceof MailableContract) {
|
||||
throw new InvalidArgumentException('Only mailables may be queued.');
|
||||
}
|
||||
|
||||
return $view->queue($this->queue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Queue a new e-mail message for sending on the given queue.
|
||||
*
|
||||
* @param string $queue
|
||||
* @param string|array $view
|
||||
* @param array $data
|
||||
* @param \Closure|string $callback
|
||||
* @return mixed
|
||||
*/
|
||||
public function onQueue($queue, $view, array $data, $callback)
|
||||
{
|
||||
return $this->queue($view, $data, $callback, $queue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Queue a new e-mail message for sending on the given queue.
|
||||
*
|
||||
* This method didn't match rest of framework's "onQueue" phrasing. Added "onQueue".
|
||||
*
|
||||
* @param string $queue
|
||||
* @param string|array $view
|
||||
* @param array $data
|
||||
* @param \Closure|string $callback
|
||||
* @return mixed
|
||||
*/
|
||||
public function queueOn($queue, $view, array $data, $callback)
|
||||
{
|
||||
return $this->onQueue($queue, $view, $data, $callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* Queue a new e-mail message for sending after (n) seconds.
|
||||
*
|
||||
* @param int $delay
|
||||
* @param string|array $view
|
||||
* @param array $data
|
||||
* @param \Closure|string $callback
|
||||
* @param string|null $queue
|
||||
* @return mixed
|
||||
*/
|
||||
public function later($delay, $view, array $data = [], $callback = null, $queue = null)
|
||||
{
|
||||
if (! $view instanceof MailableContract) {
|
||||
throw new InvalidArgumentException('Only mailables may be queued.');
|
||||
}
|
||||
|
||||
return $view->later($delay, $this->queue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Queue a new e-mail message for sending after (n) seconds on the given queue.
|
||||
*
|
||||
* @param string $queue
|
||||
* @param int $delay
|
||||
* @param string|array $view
|
||||
* @param array $data
|
||||
* @param \Closure|string $callback
|
||||
* @return mixed
|
||||
*/
|
||||
public function laterOn($queue, $delay, $view, array $data, $callback)
|
||||
{
|
||||
return $this->later($delay, $view, $data, $callback, $queue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new message instance.
|
||||
*
|
||||
* @return \Illuminate\Mail\Message
|
||||
*/
|
||||
protected function createMessage()
|
||||
{
|
||||
$message = new Message($this->swift->createMessage('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 (! empty($this->from['address'])) {
|
||||
$message->from($this->from['address'], $this->from['name']);
|
||||
}
|
||||
|
||||
// When a global reply address was specified we will set this 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 (! empty($this->replyTo['address'])) {
|
||||
$message->replyTo($this->replyTo['address'], $this->replyTo['name']);
|
||||
}
|
||||
|
||||
return $message;
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a Swift Message instance.
|
||||
*
|
||||
* @param \Swift_Message $message
|
||||
* @return void
|
||||
*/
|
||||
protected function sendSwiftMessage($message)
|
||||
{
|
||||
try {
|
||||
return $this->swift->send($message, $this->failedRecipients);
|
||||
} finally {
|
||||
$this->forceReconnection();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if the message can be sent.
|
||||
*
|
||||
* @param \Swift_Message $message
|
||||
* @return bool
|
||||
*/
|
||||
protected function shouldSendMessage($message)
|
||||
{
|
||||
if (! $this->events) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return $this->events->until(
|
||||
new Events\MessageSending($message)
|
||||
) !== false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Dispatch the message sent event.
|
||||
*
|
||||
* @param \Illuminate\Mail\Message $message
|
||||
* @return void
|
||||
*/
|
||||
protected function dispatchSentEvent($message)
|
||||
{
|
||||
if ($this->events) {
|
||||
$this->events->dispatch(
|
||||
new Events\MessageSent($message->getSwiftMessage())
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Force the transport to re-connect.
|
||||
*
|
||||
* This will prevent errors in daemon queue situations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function forceReconnection()
|
||||
{
|
||||
$this->getSwiftMailer()->getTransport()->stop();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the view factory instance.
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\Factory
|
||||
*/
|
||||
public function getViewFactory()
|
||||
{
|
||||
return $this->views;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Swift Mailer instance.
|
||||
*
|
||||
* @return \Swift_Mailer
|
||||
*/
|
||||
public function getSwiftMailer()
|
||||
{
|
||||
return $this->swift;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the array of failed recipients.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function failures()
|
||||
{
|
||||
return $this->failedRecipients;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the Swift Mailer instance.
|
||||
*
|
||||
* @param \Swift_Mailer $swift
|
||||
* @return void
|
||||
*/
|
||||
public function setSwiftMailer($swift)
|
||||
{
|
||||
$this->swift = $swift;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the queue manager instance.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Queue\Factory $queue
|
||||
* @return $this
|
||||
*/
|
||||
public function setQueue(QueueContract $queue)
|
||||
{
|
||||
$this->queue = $queue;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
148
vendor/laravel/framework/src/Illuminate/Mail/Markdown.php
vendored
Normal file
148
vendor/laravel/framework/src/Illuminate/Mail/Markdown.php
vendored
Normal file
@@ -0,0 +1,148 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Mail;
|
||||
|
||||
use Parsedown;
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Support\HtmlString;
|
||||
use Illuminate\Contracts\View\Factory as ViewFactory;
|
||||
use TijsVerkoyen\CssToInlineStyles\CssToInlineStyles;
|
||||
|
||||
class Markdown
|
||||
{
|
||||
/**
|
||||
* The view factory implementation.
|
||||
*
|
||||
* @var \Illuminate\View\Factory
|
||||
*/
|
||||
protected $view;
|
||||
|
||||
/**
|
||||
* The current theme being used when generating emails.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $theme = 'default';
|
||||
|
||||
/**
|
||||
* The registered component paths.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $componentPaths = [];
|
||||
|
||||
/**
|
||||
* Create a new Markdown renderer instance.
|
||||
*
|
||||
* @param \Illuminate\Contracts\View\Factory $view
|
||||
* @param array $options
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(ViewFactory $view, array $options = [])
|
||||
{
|
||||
$this->view = $view;
|
||||
$this->theme = Arr::get($options, 'theme', 'default');
|
||||
$this->loadComponentsFrom(Arr::get($options, 'paths', []));
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the Markdown template into HTML.
|
||||
*
|
||||
* @param string $view
|
||||
* @param array $data
|
||||
* @param \TijsVerkoyen\CssToInlineStyles\CssToInlineStyles|null $inliner
|
||||
* @return \Illuminate\Support\HtmlString
|
||||
*/
|
||||
public function render($view, array $data = [], $inliner = null)
|
||||
{
|
||||
$this->view->flushFinderCache();
|
||||
|
||||
$contents = $this->view->replaceNamespace(
|
||||
'mail', $this->htmlComponentPaths()
|
||||
)->make($view, $data)->render();
|
||||
|
||||
return new HtmlString(with($inliner ?: new CssToInlineStyles)->convert(
|
||||
$contents, $this->view->make('mail::themes.'.$this->theme)->render()
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the Markdown template into HTML.
|
||||
*
|
||||
* @param string $view
|
||||
* @param array $data
|
||||
* @return \Illuminate\Support\HtmlString
|
||||
*/
|
||||
public function renderText($view, array $data = [])
|
||||
{
|
||||
$this->view->flushFinderCache();
|
||||
|
||||
$contents = $this->view->replaceNamespace(
|
||||
'mail', $this->markdownComponentPaths()
|
||||
)->make($view, $data)->render();
|
||||
|
||||
return new HtmlString(
|
||||
html_entity_decode(preg_replace("/[\r\n]{2,}/", "\n\n", $contents), ENT_QUOTES, 'UTF-8')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the given Markdown text into HTML.
|
||||
*
|
||||
* @param string $text
|
||||
* @return string
|
||||
*/
|
||||
public static function parse($text)
|
||||
{
|
||||
$parsedown = new Parsedown;
|
||||
|
||||
return new HtmlString($parsedown->text($text));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the HTML component paths.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function htmlComponentPaths()
|
||||
{
|
||||
return array_map(function ($path) {
|
||||
return $path.'/html';
|
||||
}, $this->componentPaths());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Markdown component paths.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function markdownComponentPaths()
|
||||
{
|
||||
return array_map(function ($path) {
|
||||
return $path.'/markdown';
|
||||
}, $this->componentPaths());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the component paths.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function componentPaths()
|
||||
{
|
||||
return array_unique(array_merge($this->componentPaths, [
|
||||
__DIR__.'/resources/views',
|
||||
]));
|
||||
}
|
||||
|
||||
/**
|
||||
* Register new mail component paths.
|
||||
*
|
||||
* @param array $paths
|
||||
* @return void
|
||||
*/
|
||||
public function loadComponentsFrom(array $paths = [])
|
||||
{
|
||||
$this->componentPaths = $paths;
|
||||
}
|
||||
}
|
||||
325
vendor/laravel/framework/src/Illuminate/Mail/Message.php
vendored
Executable file
325
vendor/laravel/framework/src/Illuminate/Mail/Message.php
vendored
Executable file
@@ -0,0 +1,325 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Mail;
|
||||
|
||||
use Swift_Image;
|
||||
use Swift_Attachment;
|
||||
|
||||
class Message
|
||||
{
|
||||
/**
|
||||
* The Swift Message instance.
|
||||
*
|
||||
* @var \Swift_Message
|
||||
*/
|
||||
protected $swift;
|
||||
|
||||
/**
|
||||
* CIDs of files embedded in the message.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $embeddedFiles = [];
|
||||
|
||||
/**
|
||||
* Create a new message instance.
|
||||
*
|
||||
* @param \Swift_Message $swift
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($swift)
|
||||
{
|
||||
$this->swift = $swift;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a "from" address to the message.
|
||||
*
|
||||
* @param string|array $address
|
||||
* @param string|null $name
|
||||
* @return $this
|
||||
*/
|
||||
public function from($address, $name = null)
|
||||
{
|
||||
$this->swift->setFrom($address, $name);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the "sender" of the message.
|
||||
*
|
||||
* @param string|array $address
|
||||
* @param string|null $name
|
||||
* @return $this
|
||||
*/
|
||||
public function sender($address, $name = null)
|
||||
{
|
||||
$this->swift->setSender($address, $name);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the "return path" of the message.
|
||||
*
|
||||
* @param string $address
|
||||
* @return $this
|
||||
*/
|
||||
public function returnPath($address)
|
||||
{
|
||||
$this->swift->setReturnPath($address);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a recipient to the message.
|
||||
*
|
||||
* @param string|array $address
|
||||
* @param string|null $name
|
||||
* @param bool $override
|
||||
* @return $this
|
||||
*/
|
||||
public function to($address, $name = null, $override = false)
|
||||
{
|
||||
if ($override) {
|
||||
$this->swift->setTo($address, $name);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
return $this->addAddresses($address, $name, 'To');
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a carbon copy to the message.
|
||||
*
|
||||
* @param string|array $address
|
||||
* @param string|null $name
|
||||
* @param bool $override
|
||||
* @return $this
|
||||
*/
|
||||
public function cc($address, $name = null, $override = false)
|
||||
{
|
||||
if ($override) {
|
||||
$this->swift->setCc($address, $name);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
return $this->addAddresses($address, $name, 'Cc');
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a blind carbon copy to the message.
|
||||
*
|
||||
* @param string|array $address
|
||||
* @param string|null $name
|
||||
* @param bool $override
|
||||
* @return $this
|
||||
*/
|
||||
public function bcc($address, $name = null, $override = false)
|
||||
{
|
||||
if ($override) {
|
||||
$this->swift->setBcc($address, $name);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
return $this->addAddresses($address, $name, 'Bcc');
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a reply to address to the message.
|
||||
*
|
||||
* @param string|array $address
|
||||
* @param string|null $name
|
||||
* @return $this
|
||||
*/
|
||||
public function replyTo($address, $name = null)
|
||||
{
|
||||
return $this->addAddresses($address, $name, 'ReplyTo');
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a recipient to the message.
|
||||
*
|
||||
* @param string|array $address
|
||||
* @param string $name
|
||||
* @param string $type
|
||||
* @return $this
|
||||
*/
|
||||
protected function addAddresses($address, $name, $type)
|
||||
{
|
||||
if (is_array($address)) {
|
||||
$this->swift->{"set{$type}"}($address, $name);
|
||||
} else {
|
||||
$this->swift->{"add{$type}"}($address, $name);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the subject of the message.
|
||||
*
|
||||
* @param string $subject
|
||||
* @return $this
|
||||
*/
|
||||
public function subject($subject)
|
||||
{
|
||||
$this->swift->setSubject($subject);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the message priority level.
|
||||
*
|
||||
* @param int $level
|
||||
* @return $this
|
||||
*/
|
||||
public function priority($level)
|
||||
{
|
||||
$this->swift->setPriority($level);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Attach a file to the message.
|
||||
*
|
||||
* @param string $file
|
||||
* @param array $options
|
||||
* @return $this
|
||||
*/
|
||||
public function attach($file, array $options = [])
|
||||
{
|
||||
$attachment = $this->createAttachmentFromPath($file);
|
||||
|
||||
return $this->prepAttachment($attachment, $options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a Swift Attachment instance.
|
||||
*
|
||||
* @param string $file
|
||||
* @return \Swift_Attachment
|
||||
*/
|
||||
protected function createAttachmentFromPath($file)
|
||||
{
|
||||
return Swift_Attachment::fromPath($file);
|
||||
}
|
||||
|
||||
/**
|
||||
* Attach in-memory data as an attachment.
|
||||
*
|
||||
* @param string $data
|
||||
* @param string $name
|
||||
* @param array $options
|
||||
* @return $this
|
||||
*/
|
||||
public function attachData($data, $name, array $options = [])
|
||||
{
|
||||
$attachment = $this->createAttachmentFromData($data, $name);
|
||||
|
||||
return $this->prepAttachment($attachment, $options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a Swift Attachment instance from data.
|
||||
*
|
||||
* @param string $data
|
||||
* @param string $name
|
||||
* @return \Swift_Attachment
|
||||
*/
|
||||
protected function createAttachmentFromData($data, $name)
|
||||
{
|
||||
return Swift_Attachment::newInstance($data, $name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Embed a file in the message and get the CID.
|
||||
*
|
||||
* @param string $file
|
||||
* @return string
|
||||
*/
|
||||
public function embed($file)
|
||||
{
|
||||
if (isset($this->embeddedFiles[$file])) {
|
||||
return $this->embeddedFiles[$file];
|
||||
}
|
||||
|
||||
return $this->embeddedFiles[$file] = $this->swift->embed(
|
||||
Swift_Image::fromPath($file)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Embed in-memory data in the message and get the CID.
|
||||
*
|
||||
* @param string $data
|
||||
* @param string $name
|
||||
* @param string|null $contentType
|
||||
* @return string
|
||||
*/
|
||||
public function embedData($data, $name, $contentType = null)
|
||||
{
|
||||
$image = Swift_Image::newInstance($data, $name, $contentType);
|
||||
|
||||
return $this->swift->embed($image);
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare and attach the given attachment.
|
||||
*
|
||||
* @param \Swift_Attachment $attachment
|
||||
* @param array $options
|
||||
* @return $this
|
||||
*/
|
||||
protected function prepAttachment($attachment, $options = [])
|
||||
{
|
||||
// First we will check for a MIME type on the message, which instructs the
|
||||
// mail client on what type of attachment the file is so that it may be
|
||||
// downloaded correctly by the user. The MIME option is not required.
|
||||
if (isset($options['mime'])) {
|
||||
$attachment->setContentType($options['mime']);
|
||||
}
|
||||
|
||||
// If an alternative name was given as an option, we will set that on this
|
||||
// attachment so that it will be downloaded with the desired names from
|
||||
// the developer, otherwise the default file names will get assigned.
|
||||
if (isset($options['as'])) {
|
||||
$attachment->setFilename($options['as']);
|
||||
}
|
||||
|
||||
$this->swift->attach($attachment);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the underlying Swift Message instance.
|
||||
*
|
||||
* @return \Swift_Message
|
||||
*/
|
||||
public function getSwiftMessage()
|
||||
{
|
||||
return $this->swift;
|
||||
}
|
||||
|
||||
/**
|
||||
* Dynamically pass missing methods to the Swift instance.
|
||||
*
|
||||
* @param string $method
|
||||
* @param array $parameters
|
||||
* @return mixed
|
||||
*/
|
||||
public function __call($method, $parameters)
|
||||
{
|
||||
$callable = [$this->swift, $method];
|
||||
|
||||
return call_user_func_array($callable, $parameters);
|
||||
}
|
||||
}
|
||||
154
vendor/laravel/framework/src/Illuminate/Mail/PendingMail.php
vendored
Normal file
154
vendor/laravel/framework/src/Illuminate/Mail/PendingMail.php
vendored
Normal file
@@ -0,0 +1,154 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Mail;
|
||||
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
|
||||
class PendingMail
|
||||
{
|
||||
/**
|
||||
* The mailer instance.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $mailer;
|
||||
|
||||
/**
|
||||
* The "to" recipients of the message.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $to = [];
|
||||
|
||||
/**
|
||||
* The "cc" recipients of the message.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $cc = [];
|
||||
|
||||
/**
|
||||
* The "bcc" recipients of the message.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $bcc = [];
|
||||
|
||||
/**
|
||||
* Create a new mailable mailer instance.
|
||||
*
|
||||
* @param Mailer $mailer
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Mailer $mailer)
|
||||
{
|
||||
$this->mailer = $mailer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the recipients of the message.
|
||||
*
|
||||
* @param mixed $users
|
||||
* @return $this
|
||||
*/
|
||||
public function to($users)
|
||||
{
|
||||
$this->to = $users;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the recipients of the message.
|
||||
*
|
||||
* @param mixed $users
|
||||
* @return $this
|
||||
*/
|
||||
public function cc($users)
|
||||
{
|
||||
$this->cc = $users;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the recipients of the message.
|
||||
*
|
||||
* @param mixed $users
|
||||
* @return $this
|
||||
*/
|
||||
public function bcc($users)
|
||||
{
|
||||
$this->bcc = $users;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a new mailable message instance.
|
||||
*
|
||||
* @param Mailable $mailable
|
||||
* @return mixed
|
||||
*/
|
||||
public function send(Mailable $mailable)
|
||||
{
|
||||
if ($mailable instanceof ShouldQueue) {
|
||||
return $this->queue($mailable);
|
||||
}
|
||||
|
||||
return $this->mailer->send($this->fill($mailable));
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a mailable message immediately.
|
||||
*
|
||||
* @param Mailable $mailable
|
||||
* @return mixed
|
||||
*/
|
||||
public function sendNow(Mailable $mailable)
|
||||
{
|
||||
return $this->mailer->send($this->fill($mailable));
|
||||
}
|
||||
|
||||
/**
|
||||
* Push the given mailable onto the queue.
|
||||
*
|
||||
* @param Mailable $mailable
|
||||
* @return mixed
|
||||
*/
|
||||
public function queue(Mailable $mailable)
|
||||
{
|
||||
$mailable = $this->fill($mailable);
|
||||
|
||||
if (isset($mailable->delay)) {
|
||||
return $this->mailer->later($mailable->delay, $mailable);
|
||||
}
|
||||
|
||||
return $this->mailer->queue($mailable);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deliver the queued message after the given delay.
|
||||
*
|
||||
* @param \DateTime|int $delay
|
||||
* @param Mailable $mailable
|
||||
* @return mixed
|
||||
*/
|
||||
public function later($delay, Mailable $mailable)
|
||||
{
|
||||
return $this->mailer->later($delay, $this->fill($mailable));
|
||||
}
|
||||
|
||||
/**
|
||||
* Populate the mailable with the addresses.
|
||||
*
|
||||
* @param Mailable $mailable
|
||||
* @return Mailable
|
||||
*/
|
||||
protected function fill(Mailable $mailable)
|
||||
{
|
||||
return $mailable->to($this->to)
|
||||
->cc($this->cc)
|
||||
->bcc($this->bcc);
|
||||
}
|
||||
}
|
||||
64
vendor/laravel/framework/src/Illuminate/Mail/SendQueuedMailable.php
vendored
Normal file
64
vendor/laravel/framework/src/Illuminate/Mail/SendQueuedMailable.php
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Mail;
|
||||
|
||||
use Illuminate\Contracts\Mail\Mailer as MailerContract;
|
||||
use Illuminate\Contracts\Mail\Mailable as MailableContract;
|
||||
|
||||
class SendQueuedMailable
|
||||
{
|
||||
/**
|
||||
* The mailable message instance.
|
||||
*
|
||||
* @var Mailable
|
||||
*/
|
||||
public $mailable;
|
||||
|
||||
/**
|
||||
* The number of times the job may be attempted.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public $tries;
|
||||
|
||||
/**
|
||||
* The number of seconds the job can run before timing out.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public $timeout;
|
||||
|
||||
/**
|
||||
* Create a new job instance.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Mail\Mailable $mailable
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(MailableContract $mailable)
|
||||
{
|
||||
$this->mailable = $mailable;
|
||||
$this->tries = property_exists($mailable, 'tries') ? $mailable->tries : null;
|
||||
$this->timeout = property_exists($mailable, 'timeout') ? $mailable->timeout : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the queued job.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Mail\Mailer $mailer
|
||||
* @return void
|
||||
*/
|
||||
public function handle(MailerContract $mailer)
|
||||
{
|
||||
$this->mailable->send($mailer);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the display name for the queued job.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function displayName()
|
||||
{
|
||||
return get_class($this->mailable);
|
||||
}
|
||||
}
|
||||
58
vendor/laravel/framework/src/Illuminate/Mail/Transport/ArrayTransport.php
vendored
Normal file
58
vendor/laravel/framework/src/Illuminate/Mail/Transport/ArrayTransport.php
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Mail\Transport;
|
||||
|
||||
use Swift_Mime_Message;
|
||||
use Illuminate\Support\Collection;
|
||||
|
||||
class ArrayTransport extends Transport
|
||||
{
|
||||
/**
|
||||
* The collection of Swift Messages.
|
||||
*
|
||||
* @var \Illuminate\Support\Collection
|
||||
*/
|
||||
protected $messages;
|
||||
|
||||
/**
|
||||
* Create a new array transport instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->messages = new Collection;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function send(Swift_Mime_Message $message, &$failedRecipients = null)
|
||||
{
|
||||
$this->beforeSendPerformed($message);
|
||||
|
||||
$this->messages[] = $message;
|
||||
|
||||
return $this->numberOfRecipients($message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the collection of messages.
|
||||
*
|
||||
* @return \Illuminate\Support\Collection
|
||||
*/
|
||||
public function messages()
|
||||
{
|
||||
return $this->messages;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear all of the messages from the local collection.
|
||||
*
|
||||
* @return \Illuminate\Support\Collection
|
||||
*/
|
||||
public function flush()
|
||||
{
|
||||
return $this->messages = new Collection;
|
||||
}
|
||||
}
|
||||
59
vendor/laravel/framework/src/Illuminate/Mail/Transport/LogTransport.php
vendored
Normal file
59
vendor/laravel/framework/src/Illuminate/Mail/Transport/LogTransport.php
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Mail\Transport;
|
||||
|
||||
use Swift_Mime_Message;
|
||||
use Swift_Mime_MimeEntity;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class LogTransport extends Transport
|
||||
{
|
||||
/**
|
||||
* The Logger instance.
|
||||
*
|
||||
* @var \Psr\Log\LoggerInterface
|
||||
*/
|
||||
protected $logger;
|
||||
|
||||
/**
|
||||
* Create a new log transport instance.
|
||||
*
|
||||
* @param \Psr\Log\LoggerInterface $logger
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(LoggerInterface $logger)
|
||||
{
|
||||
$this->logger = $logger;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function send(Swift_Mime_Message $message, &$failedRecipients = null)
|
||||
{
|
||||
$this->beforeSendPerformed($message);
|
||||
|
||||
$this->logger->debug($this->getMimeEntityString($message));
|
||||
|
||||
$this->sendPerformed($message);
|
||||
|
||||
return $this->numberOfRecipients($message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a loggable string out of a Swiftmailer entity.
|
||||
*
|
||||
* @param \Swift_Mime_MimeEntity $entity
|
||||
* @return string
|
||||
*/
|
||||
protected function getMimeEntityString(Swift_Mime_MimeEntity $entity)
|
||||
{
|
||||
$string = (string) $entity->getHeaders().PHP_EOL.$entity->getBody();
|
||||
|
||||
foreach ($entity->getChildren() as $children) {
|
||||
$string .= PHP_EOL.PHP_EOL.$this->getMimeEntityString($children);
|
||||
}
|
||||
|
||||
return $string;
|
||||
}
|
||||
}
|
||||
168
vendor/laravel/framework/src/Illuminate/Mail/Transport/MailgunTransport.php
vendored
Normal file
168
vendor/laravel/framework/src/Illuminate/Mail/Transport/MailgunTransport.php
vendored
Normal file
@@ -0,0 +1,168 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Mail\Transport;
|
||||
|
||||
use Swift_Mime_Message;
|
||||
use GuzzleHttp\ClientInterface;
|
||||
|
||||
class MailgunTransport extends Transport
|
||||
{
|
||||
/**
|
||||
* Guzzle client instance.
|
||||
*
|
||||
* @var \GuzzleHttp\ClientInterface
|
||||
*/
|
||||
protected $client;
|
||||
|
||||
/**
|
||||
* The Mailgun API key.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $key;
|
||||
|
||||
/**
|
||||
* The Mailgun domain.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $domain;
|
||||
|
||||
/**
|
||||
* THe Mailgun API end-point.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $url;
|
||||
|
||||
/**
|
||||
* Create a new Mailgun transport instance.
|
||||
*
|
||||
* @param \GuzzleHttp\ClientInterface $client
|
||||
* @param string $key
|
||||
* @param string $domain
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(ClientInterface $client, $key, $domain)
|
||||
{
|
||||
$this->key = $key;
|
||||
$this->client = $client;
|
||||
$this->setDomain($domain);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function send(Swift_Mime_Message $message, &$failedRecipients = null)
|
||||
{
|
||||
$this->beforeSendPerformed($message);
|
||||
|
||||
$to = $this->getTo($message);
|
||||
|
||||
$message->setBcc([]);
|
||||
|
||||
$this->client->post($this->url, $this->payload($message, $to));
|
||||
|
||||
$this->sendPerformed($message);
|
||||
|
||||
return $this->numberOfRecipients($message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the HTTP payload for sending the Mailgun message.
|
||||
*
|
||||
* @param \Swift_Mime_Message $message
|
||||
* @param string $to
|
||||
* @return array
|
||||
*/
|
||||
protected function payload(Swift_Mime_Message $message, $to)
|
||||
{
|
||||
return [
|
||||
'auth' => [
|
||||
'api',
|
||||
$this->key,
|
||||
],
|
||||
'multipart' => [
|
||||
[
|
||||
'name' => 'to',
|
||||
'contents' => $to,
|
||||
],
|
||||
[
|
||||
'name' => 'message',
|
||||
'contents' => $message->toString(),
|
||||
'filename' => 'message.mime',
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the "to" payload field for the API request.
|
||||
*
|
||||
* @param \Swift_Mime_Message $message
|
||||
* @return string
|
||||
*/
|
||||
protected function getTo(Swift_Mime_Message $message)
|
||||
{
|
||||
return collect($this->allContacts($message))->map(function ($display, $address) {
|
||||
return $display ? $display." <{$address}>" : $address;
|
||||
})->values()->implode(',');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all of the contacts for the message.
|
||||
*
|
||||
* @param \Swift_Mime_Message $message
|
||||
* @return array
|
||||
*/
|
||||
protected function allContacts(Swift_Mime_Message $message)
|
||||
{
|
||||
return array_merge(
|
||||
(array) $message->getTo(), (array) $message->getCc(), (array) $message->getBcc()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the API key being used by the transport.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getKey()
|
||||
{
|
||||
return $this->key;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the API key being used by the transport.
|
||||
*
|
||||
* @param string $key
|
||||
* @return string
|
||||
*/
|
||||
public function setKey($key)
|
||||
{
|
||||
return $this->key = $key;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the domain being used by the transport.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDomain()
|
||||
{
|
||||
return $this->domain;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the domain being used by the transport.
|
||||
*
|
||||
* @param string $domain
|
||||
* @return void
|
||||
*/
|
||||
public function setDomain($domain)
|
||||
{
|
||||
$this->url = 'https://api.mailgun.net/v3/'.$domain.'/messages.mime';
|
||||
|
||||
return $this->domain = $domain;
|
||||
}
|
||||
}
|
||||
105
vendor/laravel/framework/src/Illuminate/Mail/Transport/MandrillTransport.php
vendored
Normal file
105
vendor/laravel/framework/src/Illuminate/Mail/Transport/MandrillTransport.php
vendored
Normal file
@@ -0,0 +1,105 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Mail\Transport;
|
||||
|
||||
use Swift_Mime_Message;
|
||||
use GuzzleHttp\ClientInterface;
|
||||
|
||||
class MandrillTransport extends Transport
|
||||
{
|
||||
/**
|
||||
* Guzzle client instance.
|
||||
*
|
||||
* @var \GuzzleHttp\ClientInterface
|
||||
*/
|
||||
protected $client;
|
||||
|
||||
/**
|
||||
* The Mandrill API key.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $key;
|
||||
|
||||
/**
|
||||
* Create a new Mandrill transport instance.
|
||||
*
|
||||
* @param \GuzzleHttp\ClientInterface $client
|
||||
* @param string $key
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(ClientInterface $client, $key)
|
||||
{
|
||||
$this->key = $key;
|
||||
$this->client = $client;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function send(Swift_Mime_Message $message, &$failedRecipients = null)
|
||||
{
|
||||
$this->beforeSendPerformed($message);
|
||||
|
||||
$this->client->post('https://mandrillapp.com/api/1.0/messages/send-raw.json', [
|
||||
'form_params' => [
|
||||
'key' => $this->key,
|
||||
'to' => $this->getTo($message),
|
||||
'raw_message' => $message->toString(),
|
||||
'async' => true,
|
||||
],
|
||||
]);
|
||||
|
||||
$this->sendPerformed($message);
|
||||
|
||||
return $this->numberOfRecipients($message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all the addresses this message should be sent to.
|
||||
*
|
||||
* Note that Mandrill still respects CC, BCC headers in raw message itself.
|
||||
*
|
||||
* @param \Swift_Mime_Message $message
|
||||
* @return array
|
||||
*/
|
||||
protected function getTo(Swift_Mime_Message $message)
|
||||
{
|
||||
$to = [];
|
||||
|
||||
if ($message->getTo()) {
|
||||
$to = array_merge($to, array_keys($message->getTo()));
|
||||
}
|
||||
|
||||
if ($message->getCc()) {
|
||||
$to = array_merge($to, array_keys($message->getCc()));
|
||||
}
|
||||
|
||||
if ($message->getBcc()) {
|
||||
$to = array_merge($to, array_keys($message->getBcc()));
|
||||
}
|
||||
|
||||
return $to;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the API key being used by the transport.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getKey()
|
||||
{
|
||||
return $this->key;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the API key being used by the transport.
|
||||
*
|
||||
* @param string $key
|
||||
* @return string
|
||||
*/
|
||||
public function setKey($key)
|
||||
{
|
||||
return $this->key = $key;
|
||||
}
|
||||
}
|
||||
48
vendor/laravel/framework/src/Illuminate/Mail/Transport/SesTransport.php
vendored
Normal file
48
vendor/laravel/framework/src/Illuminate/Mail/Transport/SesTransport.php
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Mail\Transport;
|
||||
|
||||
use Aws\Ses\SesClient;
|
||||
use Swift_Mime_Message;
|
||||
|
||||
class SesTransport extends Transport
|
||||
{
|
||||
/**
|
||||
* The Amazon SES instance.
|
||||
*
|
||||
* @var \Aws\Ses\SesClient
|
||||
*/
|
||||
protected $ses;
|
||||
|
||||
/**
|
||||
* Create a new SES transport instance.
|
||||
*
|
||||
* @param \Aws\Ses\SesClient $ses
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(SesClient $ses)
|
||||
{
|
||||
$this->ses = $ses;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function send(Swift_Mime_Message $message, &$failedRecipients = null)
|
||||
{
|
||||
$this->beforeSendPerformed($message);
|
||||
|
||||
$headers = $message->getHeaders();
|
||||
|
||||
$headers->addTextHeader('X-SES-Message-ID', $this->ses->sendRawEmail([
|
||||
'Source' => key($message->getSender() ?: $message->getFrom()),
|
||||
'RawMessage' => [
|
||||
'Data' => $message->toString(),
|
||||
],
|
||||
])->get('MessageId'));
|
||||
|
||||
$this->sendPerformed($message);
|
||||
|
||||
return $this->numberOfRecipients($message);
|
||||
}
|
||||
}
|
||||
159
vendor/laravel/framework/src/Illuminate/Mail/Transport/SparkPostTransport.php
vendored
Normal file
159
vendor/laravel/framework/src/Illuminate/Mail/Transport/SparkPostTransport.php
vendored
Normal file
@@ -0,0 +1,159 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Mail\Transport;
|
||||
|
||||
use Swift_Mime_Message;
|
||||
use GuzzleHttp\ClientInterface;
|
||||
|
||||
class SparkPostTransport extends Transport
|
||||
{
|
||||
/**
|
||||
* Guzzle client instance.
|
||||
*
|
||||
* @var \GuzzleHttp\ClientInterface
|
||||
*/
|
||||
protected $client;
|
||||
|
||||
/**
|
||||
* The SparkPost API key.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $key;
|
||||
|
||||
/**
|
||||
* Transmission options.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $options = [];
|
||||
|
||||
/**
|
||||
* Create a new SparkPost transport instance.
|
||||
*
|
||||
* @param \GuzzleHttp\ClientInterface $client
|
||||
* @param string $key
|
||||
* @param array $options
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(ClientInterface $client, $key, $options = [])
|
||||
{
|
||||
$this->key = $key;
|
||||
$this->client = $client;
|
||||
$this->options = $options;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function send(Swift_Mime_Message $message, &$failedRecipients = null)
|
||||
{
|
||||
$this->beforeSendPerformed($message);
|
||||
|
||||
$recipients = $this->getRecipients($message);
|
||||
|
||||
$message->setBcc([]);
|
||||
|
||||
$response = $this->client->post('https://api.sparkpost.com/api/v1/transmissions', [
|
||||
'headers' => [
|
||||
'Authorization' => $this->key,
|
||||
],
|
||||
'json' => array_merge([
|
||||
'recipients' => $recipients,
|
||||
'content' => [
|
||||
'email_rfc822' => $message->toString(),
|
||||
],
|
||||
], $this->options),
|
||||
]);
|
||||
|
||||
$message->getHeaders()->addTextHeader(
|
||||
'X-SparkPost-Transmission-ID', $this->getTransmissionId($response)
|
||||
);
|
||||
|
||||
$this->sendPerformed($message);
|
||||
|
||||
return $this->numberOfRecipients($message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all the addresses this message should be sent to.
|
||||
*
|
||||
* Note that SparkPost still respects CC, BCC headers in raw message itself.
|
||||
*
|
||||
* @param \Swift_Mime_Message $message
|
||||
* @return array
|
||||
*/
|
||||
protected function getRecipients(Swift_Mime_Message $message)
|
||||
{
|
||||
$recipients = [];
|
||||
|
||||
foreach ((array) $message->getTo() as $email => $name) {
|
||||
$recipients[] = ['address' => compact('name', 'email')];
|
||||
}
|
||||
|
||||
foreach ((array) $message->getCc() as $email => $name) {
|
||||
$recipients[] = ['address' => compact('name', 'email')];
|
||||
}
|
||||
|
||||
foreach ((array) $message->getBcc() as $email => $name) {
|
||||
$recipients[] = ['address' => compact('name', 'email')];
|
||||
}
|
||||
|
||||
return $recipients;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the transmission ID from the response.
|
||||
*
|
||||
* @param \GuzzleHttp\Psr7\Response $response
|
||||
* @return string
|
||||
*/
|
||||
protected function getTransmissionId($response)
|
||||
{
|
||||
return object_get(
|
||||
json_decode($response->getBody()->getContents()), 'results.id'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the API key being used by the transport.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getKey()
|
||||
{
|
||||
return $this->key;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the API key being used by the transport.
|
||||
*
|
||||
* @param string $key
|
||||
* @return string
|
||||
*/
|
||||
public function setKey($key)
|
||||
{
|
||||
return $this->key = $key;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the transmission options being used by the transport.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getOptions()
|
||||
{
|
||||
return $this->options;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the transmission options being used by the transport.
|
||||
*
|
||||
* @param array $options
|
||||
* @return array
|
||||
*/
|
||||
public function setOptions(array $options)
|
||||
{
|
||||
return $this->options = $options;
|
||||
}
|
||||
}
|
||||
100
vendor/laravel/framework/src/Illuminate/Mail/Transport/Transport.php
vendored
Normal file
100
vendor/laravel/framework/src/Illuminate/Mail/Transport/Transport.php
vendored
Normal file
@@ -0,0 +1,100 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Mail\Transport;
|
||||
|
||||
use Swift_Transport;
|
||||
use Swift_Mime_Message;
|
||||
use Swift_Events_SendEvent;
|
||||
use Swift_Events_EventListener;
|
||||
|
||||
abstract class Transport implements Swift_Transport
|
||||
{
|
||||
/**
|
||||
* The plug-ins registered with the transport.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $plugins = [];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function isStarted()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function start()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function stop()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a plug-in with the transport.
|
||||
*
|
||||
* @param \Swift_Events_EventListener $plugin
|
||||
* @return void
|
||||
*/
|
||||
public function registerPlugin(Swift_Events_EventListener $plugin)
|
||||
{
|
||||
array_push($this->plugins, $plugin);
|
||||
}
|
||||
|
||||
/**
|
||||
* Iterate through registered plugins and execute plugins' methods.
|
||||
*
|
||||
* @param \Swift_Mime_Message $message
|
||||
* @return void
|
||||
*/
|
||||
protected function beforeSendPerformed(Swift_Mime_Message $message)
|
||||
{
|
||||
$event = new Swift_Events_SendEvent($this, $message);
|
||||
|
||||
foreach ($this->plugins as $plugin) {
|
||||
if (method_exists($plugin, 'beforeSendPerformed')) {
|
||||
$plugin->beforeSendPerformed($event);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Iterate through registered plugins and execute plugins' methods.
|
||||
*
|
||||
* @param \Swift_Mime_Message $message
|
||||
* @return void
|
||||
*/
|
||||
protected function sendPerformed(Swift_Mime_Message $message)
|
||||
{
|
||||
$event = new Swift_Events_SendEvent($this, $message);
|
||||
|
||||
foreach ($this->plugins as $plugin) {
|
||||
if (method_exists($plugin, 'sendPerformed')) {
|
||||
$plugin->sendPerformed($event);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the number of recipients.
|
||||
*
|
||||
* @param \Swift_Mime_Message $message
|
||||
* @return int
|
||||
*/
|
||||
protected function numberOfRecipients(Swift_Mime_Message $message)
|
||||
{
|
||||
return count(array_merge(
|
||||
(array) $message->getTo(), (array) $message->getCc(), (array) $message->getBcc()
|
||||
));
|
||||
}
|
||||
}
|
||||
210
vendor/laravel/framework/src/Illuminate/Mail/TransportManager.php
vendored
Normal file
210
vendor/laravel/framework/src/Illuminate/Mail/TransportManager.php
vendored
Normal file
@@ -0,0 +1,210 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Mail;
|
||||
|
||||
use Aws\Ses\SesClient;
|
||||
use Illuminate\Support\Arr;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Illuminate\Support\Manager;
|
||||
use GuzzleHttp\Client as HttpClient;
|
||||
use Swift_MailTransport as MailTransport;
|
||||
use Swift_SmtpTransport as SmtpTransport;
|
||||
use Illuminate\Mail\Transport\LogTransport;
|
||||
use Illuminate\Mail\Transport\SesTransport;
|
||||
use Illuminate\Mail\Transport\ArrayTransport;
|
||||
use Illuminate\Mail\Transport\MailgunTransport;
|
||||
use Illuminate\Mail\Transport\MandrillTransport;
|
||||
use Illuminate\Mail\Transport\SparkPostTransport;
|
||||
use Swift_SendmailTransport as SendmailTransport;
|
||||
|
||||
class TransportManager extends Manager
|
||||
{
|
||||
/**
|
||||
* Create an instance of the SMTP Swift Transport driver.
|
||||
*
|
||||
* @return \Swift_SmtpTransport
|
||||
*/
|
||||
protected function createSmtpDriver()
|
||||
{
|
||||
$config = $this->app->make('config')->get('mail');
|
||||
|
||||
// The Swift SMTP transport instance will allow us to use any SMTP backend
|
||||
// for delivering mail such as Sendgrid, Amazon SES, or a custom server
|
||||
// a developer has available. We will just pass this configured host.
|
||||
$transport = SmtpTransport::newInstance(
|
||||
$config['host'], $config['port']
|
||||
);
|
||||
|
||||
if (isset($config['encryption'])) {
|
||||
$transport->setEncryption($config['encryption']);
|
||||
}
|
||||
|
||||
// Once we have the transport we will check for the presence of a username
|
||||
// and password. If we have it we will set the credentials on the Swift
|
||||
// transporter instance so that we'll properly authenticate delivery.
|
||||
if (isset($config['username'])) {
|
||||
$transport->setUsername($config['username']);
|
||||
|
||||
$transport->setPassword($config['password']);
|
||||
}
|
||||
|
||||
// Next we will set any stream context options specified for the transport
|
||||
// and then return it. The option is not required any may not be inside
|
||||
// the configuration array at all so we'll verify that before adding.
|
||||
if (isset($config['stream'])) {
|
||||
$transport->setStreamOptions($config['stream']);
|
||||
}
|
||||
|
||||
return $transport;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of the Sendmail Swift Transport driver.
|
||||
*
|
||||
* @return \Swift_SendmailTransport
|
||||
*/
|
||||
protected function createSendmailDriver()
|
||||
{
|
||||
return SendmailTransport::newInstance(
|
||||
$this->app['config']['mail']['sendmail']
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of the Amazon SES Swift Transport driver.
|
||||
*
|
||||
* @return \Swift_SendmailTransport
|
||||
*/
|
||||
protected function createSesDriver()
|
||||
{
|
||||
$config = array_merge($this->app['config']->get('services.ses', []), [
|
||||
'version' => 'latest', 'service' => 'email',
|
||||
]);
|
||||
|
||||
return new SesTransport(new SesClient(
|
||||
$this->addSesCredentials($config)
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the SES credentials to the configuration array.
|
||||
*
|
||||
* @param array $config
|
||||
* @return array
|
||||
*/
|
||||
protected function addSesCredentials(array $config)
|
||||
{
|
||||
if ($config['key'] && $config['secret']) {
|
||||
$config['credentials'] = Arr::only($config, ['key', 'secret']);
|
||||
}
|
||||
|
||||
return $config;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of the Mail Swift Transport driver.
|
||||
*
|
||||
* @return \Swift_MailTransport
|
||||
*/
|
||||
protected function createMailDriver()
|
||||
{
|
||||
return MailTransport::newInstance();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of the Mailgun Swift Transport driver.
|
||||
*
|
||||
* @return \Illuminate\Mail\Transport\MailgunTransport
|
||||
*/
|
||||
protected function createMailgunDriver()
|
||||
{
|
||||
$config = $this->app['config']->get('services.mailgun', []);
|
||||
|
||||
return new MailgunTransport(
|
||||
$this->guzzle($config),
|
||||
$config['secret'], $config['domain']
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of the Mandrill Swift Transport driver.
|
||||
*
|
||||
* @return \Illuminate\Mail\Transport\MandrillTransport
|
||||
*/
|
||||
protected function createMandrillDriver()
|
||||
{
|
||||
$config = $this->app['config']->get('services.mandrill', []);
|
||||
|
||||
return new MandrillTransport(
|
||||
$this->guzzle($config), $config['secret']
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of the SparkPost Swift Transport driver.
|
||||
*
|
||||
* @return \Illuminate\Mail\Transport\SparkPostTransport
|
||||
*/
|
||||
protected function createSparkPostDriver()
|
||||
{
|
||||
$config = $this->app['config']->get('services.sparkpost', []);
|
||||
|
||||
return new SparkPostTransport(
|
||||
$this->guzzle($config), $config['secret'], Arr::get($config, 'options', [])
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of the Log Swift Transport driver.
|
||||
*
|
||||
* @return \Illuminate\Mail\Transport\LogTransport
|
||||
*/
|
||||
protected function createLogDriver()
|
||||
{
|
||||
return new LogTransport($this->app->make(LoggerInterface::class));
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of the Array Swift Transport Driver.
|
||||
*
|
||||
* @return \Illuminate\Mail\Transport\ArrayTransport
|
||||
*/
|
||||
protected function createArrayDriver()
|
||||
{
|
||||
return new ArrayTransport;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a fresh Guzzle HTTP client instance.
|
||||
*
|
||||
* @param array $config
|
||||
* @return \GuzzleHttp\Client
|
||||
*/
|
||||
protected function guzzle($config)
|
||||
{
|
||||
return new HttpClient(Arr::add(
|
||||
Arr::get($config, 'guzzle', []), 'connect_timeout', 60
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the default mail driver name.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDefaultDriver()
|
||||
{
|
||||
return $this->app['config']['mail.driver'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the default mail driver name.
|
||||
*
|
||||
* @param string $name
|
||||
* @return void
|
||||
*/
|
||||
public function setDefaultDriver($name)
|
||||
{
|
||||
$this->app['config']['mail.driver'] = $name;
|
||||
}
|
||||
}
|
||||
44
vendor/laravel/framework/src/Illuminate/Mail/composer.json
vendored
Executable file
44
vendor/laravel/framework/src/Illuminate/Mail/composer.json
vendored
Executable file
@@ -0,0 +1,44 @@
|
||||
{
|
||||
"name": "illuminate/mail",
|
||||
"description": "The Illuminate Mail package.",
|
||||
"license": "MIT",
|
||||
"homepage": "https://laravel.com",
|
||||
"support": {
|
||||
"issues": "https://github.com/laravel/framework/issues",
|
||||
"source": "https://github.com/laravel/framework"
|
||||
},
|
||||
"authors": [
|
||||
{
|
||||
"name": "Taylor Otwell",
|
||||
"email": "taylor@laravel.com"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": ">=5.6.4",
|
||||
"erusev/parsedown": "~1.6",
|
||||
"illuminate/container": "5.4.*",
|
||||
"illuminate/contracts": "5.4.*",
|
||||
"illuminate/support": "5.4.*",
|
||||
"psr/log": "~1.0",
|
||||
"swiftmailer/swiftmailer": "~5.4",
|
||||
"tijsverkoyen/css-to-inline-styles": "~2.2"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Illuminate\\Mail\\": ""
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "5.4-dev"
|
||||
}
|
||||
},
|
||||
"suggest": {
|
||||
"aws/aws-sdk-php": "Required to use the SES mail driver (~3.0).",
|
||||
"guzzlehttp/guzzle": "Required to use the Mailgun and Mandrill mail drivers (~6.0)."
|
||||
},
|
||||
"config": {
|
||||
"sort-packages": true
|
||||
},
|
||||
"minimum-stability": "dev"
|
||||
}
|
||||
19
vendor/laravel/framework/src/Illuminate/Mail/resources/views/html/button.blade.php
vendored
Normal file
19
vendor/laravel/framework/src/Illuminate/Mail/resources/views/html/button.blade.php
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
<table class="action" align="center" width="100%" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td align="center">
|
||||
<table width="100%" border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td align="center">
|
||||
<table border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td>
|
||||
<a href="{{ $url }}" class="button button-{{ $color or 'blue' }}" target="_blank">{{ $slot }}</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
11
vendor/laravel/framework/src/Illuminate/Mail/resources/views/html/footer.blade.php
vendored
Normal file
11
vendor/laravel/framework/src/Illuminate/Mail/resources/views/html/footer.blade.php
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
<tr>
|
||||
<td>
|
||||
<table class="footer" align="center" width="570" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td class="content-cell" align="center">
|
||||
{{ Illuminate\Mail\Markdown::parse($slot) }}
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
7
vendor/laravel/framework/src/Illuminate/Mail/resources/views/html/header.blade.php
vendored
Normal file
7
vendor/laravel/framework/src/Illuminate/Mail/resources/views/html/header.blade.php
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
<tr>
|
||||
<td class="header">
|
||||
<a href="{{ $url }}">
|
||||
{{ $slot }}
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
54
vendor/laravel/framework/src/Illuminate/Mail/resources/views/html/layout.blade.php
vendored
Normal file
54
vendor/laravel/framework/src/Illuminate/Mail/resources/views/html/layout.blade.php
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
</head>
|
||||
<body>
|
||||
<style>
|
||||
@media only screen and (max-width: 600px) {
|
||||
.inner-body {
|
||||
width: 100% !important;
|
||||
}
|
||||
|
||||
.footer {
|
||||
width: 100% !important;
|
||||
}
|
||||
}
|
||||
|
||||
@media only screen and (max-width: 500px) {
|
||||
.button {
|
||||
width: 100% !important;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<table class="wrapper" width="100%" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td align="center">
|
||||
<table class="content" width="100%" cellpadding="0" cellspacing="0">
|
||||
{{ $header or '' }}
|
||||
|
||||
<!-- Email Body -->
|
||||
<tr>
|
||||
<td class="body" width="100%" cellpadding="0" cellspacing="0">
|
||||
<table class="inner-body" align="center" width="570" cellpadding="0" cellspacing="0">
|
||||
<!-- Body content -->
|
||||
<tr>
|
||||
<td class="content-cell">
|
||||
{{ Illuminate\Mail\Markdown::parse($slot) }}
|
||||
|
||||
{{ $subcopy or '' }}
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
{{ $footer or '' }}
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
27
vendor/laravel/framework/src/Illuminate/Mail/resources/views/html/message.blade.php
vendored
Normal file
27
vendor/laravel/framework/src/Illuminate/Mail/resources/views/html/message.blade.php
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
@component('mail::layout')
|
||||
{{-- Header --}}
|
||||
@slot('header')
|
||||
@component('mail::header', ['url' => config('app.url')])
|
||||
{{ config('app.name') }}
|
||||
@endcomponent
|
||||
@endslot
|
||||
|
||||
{{-- Body --}}
|
||||
{{ $slot }}
|
||||
|
||||
{{-- Subcopy --}}
|
||||
@isset($subcopy)
|
||||
@slot('subcopy')
|
||||
@component('mail::subcopy')
|
||||
{{ $subcopy }}
|
||||
@endcomponent
|
||||
@endslot
|
||||
@endisset
|
||||
|
||||
{{-- Footer --}}
|
||||
@slot('footer')
|
||||
@component('mail::footer')
|
||||
© {{ date('Y') }} {{ config('app.name') }}. All rights reserved.
|
||||
@endcomponent
|
||||
@endslot
|
||||
@endcomponent
|
||||
13
vendor/laravel/framework/src/Illuminate/Mail/resources/views/html/panel.blade.php
vendored
Normal file
13
vendor/laravel/framework/src/Illuminate/Mail/resources/views/html/panel.blade.php
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
<table class="panel" width="100%" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td class="panel-content">
|
||||
<table width="100%" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td class="panel-item">
|
||||
{{ Illuminate\Mail\Markdown::parse($slot) }}
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
7
vendor/laravel/framework/src/Illuminate/Mail/resources/views/html/promotion.blade.php
vendored
Normal file
7
vendor/laravel/framework/src/Illuminate/Mail/resources/views/html/promotion.blade.php
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
<table class="promotion" align="center" width="100%" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td align="center">
|
||||
{{ Illuminate\Mail\Markdown::parse($slot) }}
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
13
vendor/laravel/framework/src/Illuminate/Mail/resources/views/html/promotion/button.blade.php
vendored
Normal file
13
vendor/laravel/framework/src/Illuminate/Mail/resources/views/html/promotion/button.blade.php
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
<table width="100%" border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td align="center">
|
||||
<table border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td>
|
||||
<a href="{{ $url }}" class="button button-green" target="_blank">{{ $slot }}</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
7
vendor/laravel/framework/src/Illuminate/Mail/resources/views/html/subcopy.blade.php
vendored
Normal file
7
vendor/laravel/framework/src/Illuminate/Mail/resources/views/html/subcopy.blade.php
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
<table class="subcopy" width="100%" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td>
|
||||
{{ Illuminate\Mail\Markdown::parse($slot) }}
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
3
vendor/laravel/framework/src/Illuminate/Mail/resources/views/html/table.blade.php
vendored
Normal file
3
vendor/laravel/framework/src/Illuminate/Mail/resources/views/html/table.blade.php
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
<div class="table">
|
||||
{{ Illuminate\Mail\Markdown::parse($slot) }}
|
||||
</div>
|
||||
285
vendor/laravel/framework/src/Illuminate/Mail/resources/views/html/themes/default.css
vendored
Normal file
285
vendor/laravel/framework/src/Illuminate/Mail/resources/views/html/themes/default.css
vendored
Normal file
@@ -0,0 +1,285 @@
|
||||
/* Base */
|
||||
|
||||
body, body *:not(html):not(style):not(br):not(tr):not(code) {
|
||||
font-family: Avenir, Helvetica, sans-serif;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
body {
|
||||
background-color: #f5f8fa;
|
||||
color: #74787E;
|
||||
height: 100%;
|
||||
hyphens: auto;
|
||||
line-height: 1.4;
|
||||
margin: 0;
|
||||
-moz-hyphens: auto;
|
||||
-ms-word-break: break-all;
|
||||
width: 100% !important;
|
||||
-webkit-hyphens: auto;
|
||||
-webkit-text-size-adjust: none;
|
||||
word-break: break-all;
|
||||
word-break: break-word;
|
||||
}
|
||||
|
||||
p,
|
||||
ul,
|
||||
ol,
|
||||
blockquote {
|
||||
line-height: 1.4;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
a {
|
||||
color: #3869D4;
|
||||
}
|
||||
|
||||
a img {
|
||||
border: none;
|
||||
}
|
||||
|
||||
/* Typography */
|
||||
|
||||
h1 {
|
||||
color: #2F3133;
|
||||
font-size: 19px;
|
||||
font-weight: bold;
|
||||
margin-top: 0;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
h2 {
|
||||
color: #2F3133;
|
||||
font-size: 16px;
|
||||
font-weight: bold;
|
||||
margin-top: 0;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
h3 {
|
||||
color: #2F3133;
|
||||
font-size: 14px;
|
||||
font-weight: bold;
|
||||
margin-top: 0;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
p {
|
||||
color: #74787E;
|
||||
font-size: 16px;
|
||||
line-height: 1.5em;
|
||||
margin-top: 0;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
p.sub {
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
img {
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
/* Layout */
|
||||
|
||||
.wrapper {
|
||||
background-color: #f5f8fa;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
width: 100%;
|
||||
-premailer-cellpadding: 0;
|
||||
-premailer-cellspacing: 0;
|
||||
-premailer-width: 100%;
|
||||
}
|
||||
|
||||
.content {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
width: 100%;
|
||||
-premailer-cellpadding: 0;
|
||||
-premailer-cellspacing: 0;
|
||||
-premailer-width: 100%;
|
||||
}
|
||||
|
||||
/* Header */
|
||||
|
||||
.header {
|
||||
padding: 25px 0;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.header a {
|
||||
color: #bbbfc3;
|
||||
font-size: 19px;
|
||||
font-weight: bold;
|
||||
text-decoration: none;
|
||||
text-shadow: 0 1px 0 white;
|
||||
}
|
||||
|
||||
/* Body */
|
||||
|
||||
.body {
|
||||
background-color: #FFFFFF;
|
||||
border-bottom: 1px solid #EDEFF2;
|
||||
border-top: 1px solid #EDEFF2;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
width: 100%;
|
||||
-premailer-cellpadding: 0;
|
||||
-premailer-cellspacing: 0;
|
||||
-premailer-width: 100%;
|
||||
}
|
||||
|
||||
.inner-body {
|
||||
background-color: #FFFFFF;
|
||||
margin: 0 auto;
|
||||
padding: 0;
|
||||
width: 570px;
|
||||
-premailer-cellpadding: 0;
|
||||
-premailer-cellspacing: 0;
|
||||
-premailer-width: 570px;
|
||||
}
|
||||
|
||||
/* Subcopy */
|
||||
|
||||
.subcopy {
|
||||
border-top: 1px solid #EDEFF2;
|
||||
margin-top: 25px;
|
||||
padding-top: 25px;
|
||||
}
|
||||
|
||||
.subcopy p {
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
/* Footer */
|
||||
|
||||
.footer {
|
||||
margin: 0 auto;
|
||||
padding: 0;
|
||||
text-align: center;
|
||||
width: 570px;
|
||||
-premailer-cellpadding: 0;
|
||||
-premailer-cellspacing: 0;
|
||||
-premailer-width: 570px;
|
||||
}
|
||||
|
||||
.footer p {
|
||||
color: #AEAEAE;
|
||||
font-size: 12px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
/* Tables */
|
||||
|
||||
.table table {
|
||||
margin: 30px auto;
|
||||
width: 100%;
|
||||
-premailer-cellpadding: 0;
|
||||
-premailer-cellspacing: 0;
|
||||
-premailer-width: 100%;
|
||||
}
|
||||
|
||||
.table th {
|
||||
border-bottom: 1px solid #EDEFF2;
|
||||
padding-bottom: 8px;
|
||||
}
|
||||
|
||||
.table td {
|
||||
color: #74787E;
|
||||
font-size: 15px;
|
||||
line-height: 18px;
|
||||
padding: 10px 0;
|
||||
}
|
||||
|
||||
.content-cell {
|
||||
padding: 35px;
|
||||
}
|
||||
|
||||
/* Buttons */
|
||||
|
||||
.action {
|
||||
margin: 30px auto;
|
||||
padding: 0;
|
||||
text-align: center;
|
||||
width: 100%;
|
||||
-premailer-cellpadding: 0;
|
||||
-premailer-cellspacing: 0;
|
||||
-premailer-width: 100%;
|
||||
}
|
||||
|
||||
.button {
|
||||
border-radius: 3px;
|
||||
box-shadow: 0 2px 3px rgba(0, 0, 0, 0.16);
|
||||
color: #FFF;
|
||||
display: inline-block;
|
||||
text-decoration: none;
|
||||
-webkit-text-size-adjust: none;
|
||||
}
|
||||
|
||||
.button-blue {
|
||||
background-color: #3097D1;
|
||||
border-top: 10px solid #3097D1;
|
||||
border-right: 18px solid #3097D1;
|
||||
border-bottom: 10px solid #3097D1;
|
||||
border-left: 18px solid #3097D1;
|
||||
}
|
||||
|
||||
.button-green {
|
||||
background-color: #2ab27b;
|
||||
border-top: 10px solid #2ab27b;
|
||||
border-right: 18px solid #2ab27b;
|
||||
border-bottom: 10px solid #2ab27b;
|
||||
border-left: 18px solid #2ab27b;
|
||||
}
|
||||
|
||||
.button-red {
|
||||
background-color: #bf5329;
|
||||
border-top: 10px solid #bf5329;
|
||||
border-right: 18px solid #bf5329;
|
||||
border-bottom: 10px solid #bf5329;
|
||||
border-left: 18px solid #bf5329;
|
||||
}
|
||||
|
||||
/* Panels */
|
||||
|
||||
.panel {
|
||||
margin: 0 0 21px;
|
||||
}
|
||||
|
||||
.panel-content {
|
||||
background-color: #EDEFF2;
|
||||
padding: 16px;
|
||||
}
|
||||
|
||||
.panel-item {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.panel-item p:last-of-type {
|
||||
margin-bottom: 0;
|
||||
padding-bottom: 0;
|
||||
}
|
||||
|
||||
/* Promotions */
|
||||
|
||||
.promotion {
|
||||
background-color: #FFFFFF;
|
||||
border: 2px dashed #9BA2AB;
|
||||
margin: 0;
|
||||
margin-bottom: 25px;
|
||||
margin-top: 25px;
|
||||
padding: 24px;
|
||||
width: 100%;
|
||||
-premailer-cellpadding: 0;
|
||||
-premailer-cellspacing: 0;
|
||||
-premailer-width: 100%;
|
||||
}
|
||||
|
||||
.promotion h1 {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.promotion p {
|
||||
font-size: 15px;
|
||||
text-align: center;
|
||||
}
|
||||
1
vendor/laravel/framework/src/Illuminate/Mail/resources/views/markdown/button.blade.php
vendored
Normal file
1
vendor/laravel/framework/src/Illuminate/Mail/resources/views/markdown/button.blade.php
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{{ $slot }}: {{ $url }}
|
||||
1
vendor/laravel/framework/src/Illuminate/Mail/resources/views/markdown/footer.blade.php
vendored
Normal file
1
vendor/laravel/framework/src/Illuminate/Mail/resources/views/markdown/footer.blade.php
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{{ $slot }}
|
||||
1
vendor/laravel/framework/src/Illuminate/Mail/resources/views/markdown/header.blade.php
vendored
Normal file
1
vendor/laravel/framework/src/Illuminate/Mail/resources/views/markdown/header.blade.php
vendored
Normal file
@@ -0,0 +1 @@
|
||||
[{{ $slot }}]({{ $url }})
|
||||
9
vendor/laravel/framework/src/Illuminate/Mail/resources/views/markdown/layout.blade.php
vendored
Normal file
9
vendor/laravel/framework/src/Illuminate/Mail/resources/views/markdown/layout.blade.php
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
{!! strip_tags($header) !!}
|
||||
|
||||
{!! strip_tags($slot) !!}
|
||||
@isset($subcopy)
|
||||
|
||||
{!! strip_tags($subcopy) !!}
|
||||
@endisset
|
||||
|
||||
{!! strip_tags($footer) !!}
|
||||
27
vendor/laravel/framework/src/Illuminate/Mail/resources/views/markdown/message.blade.php
vendored
Normal file
27
vendor/laravel/framework/src/Illuminate/Mail/resources/views/markdown/message.blade.php
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
@component('mail::layout')
|
||||
{{-- Header --}}
|
||||
@slot('header')
|
||||
@component('mail::header', ['url' => config('app.url')])
|
||||
{{ config('app.name') }}
|
||||
@endcomponent
|
||||
@endslot
|
||||
|
||||
{{-- Body --}}
|
||||
{{ $slot }}
|
||||
|
||||
{{-- Subcopy --}}
|
||||
@isset($subcopy)
|
||||
@slot('subcopy')
|
||||
@component('mail::subcopy')
|
||||
{{ $subcopy }}
|
||||
@endcomponent
|
||||
@endslot
|
||||
@endisset
|
||||
|
||||
{{-- Footer --}}
|
||||
@slot('footer')
|
||||
@component('mail::footer')
|
||||
© {{ date('Y') }} {{ config('app.name') }}. All rights reserved.
|
||||
@endcomponent
|
||||
@endslot
|
||||
@endcomponent
|
||||
1
vendor/laravel/framework/src/Illuminate/Mail/resources/views/markdown/panel.blade.php
vendored
Normal file
1
vendor/laravel/framework/src/Illuminate/Mail/resources/views/markdown/panel.blade.php
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{{ $slot }}
|
||||
1
vendor/laravel/framework/src/Illuminate/Mail/resources/views/markdown/promotion.blade.php
vendored
Normal file
1
vendor/laravel/framework/src/Illuminate/Mail/resources/views/markdown/promotion.blade.php
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{{ $slot }}
|
||||
@@ -0,0 +1 @@
|
||||
[{{ $slot }}]({{ $url }})
|
||||
1
vendor/laravel/framework/src/Illuminate/Mail/resources/views/markdown/subcopy.blade.php
vendored
Normal file
1
vendor/laravel/framework/src/Illuminate/Mail/resources/views/markdown/subcopy.blade.php
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{{ $slot }}
|
||||
1
vendor/laravel/framework/src/Illuminate/Mail/resources/views/markdown/table.blade.php
vendored
Normal file
1
vendor/laravel/framework/src/Illuminate/Mail/resources/views/markdown/table.blade.php
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{{ $slot }}
|
||||
Reference in New Issue
Block a user