Primo Committ
This commit is contained in:
33
vendor/laravel/framework/src/Illuminate/Mail/Events/MessageSending.php
vendored
Normal file
33
vendor/laravel/framework/src/Illuminate/Mail/Events/MessageSending.php
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Mail\Events;
|
||||
|
||||
class MessageSending
|
||||
{
|
||||
/**
|
||||
* The Swift message instance.
|
||||
*
|
||||
* @var \Swift_Message
|
||||
*/
|
||||
public $message;
|
||||
|
||||
/**
|
||||
* The message data.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $data;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @param \Swift_Message $message
|
||||
* @param array $data
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($message, $data = [])
|
||||
{
|
||||
$this->data = $data;
|
||||
$this->message = $message;
|
||||
}
|
||||
}
|
||||
74
vendor/laravel/framework/src/Illuminate/Mail/Events/MessageSent.php
vendored
Normal file
74
vendor/laravel/framework/src/Illuminate/Mail/Events/MessageSent.php
vendored
Normal file
@@ -0,0 +1,74 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Mail\Events;
|
||||
|
||||
use Swift_Attachment;
|
||||
|
||||
class MessageSent
|
||||
{
|
||||
/**
|
||||
* The Swift message instance.
|
||||
*
|
||||
* @var \Swift_Message
|
||||
*/
|
||||
public $message;
|
||||
|
||||
/**
|
||||
* The message data.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $data;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @param \Swift_Message $message
|
||||
* @param array $data
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($message, $data = [])
|
||||
{
|
||||
$this->data = $data;
|
||||
$this->message = $message;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the serializable representation of the object.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function __serialize()
|
||||
{
|
||||
$hasAttachments = collect($this->message->getChildren())
|
||||
->whereInstanceOf(Swift_Attachment::class)
|
||||
->isNotEmpty();
|
||||
|
||||
return $hasAttachments ? [
|
||||
'message' => base64_encode(serialize($this->message)),
|
||||
'data' => base64_encode(serialize($this->data)),
|
||||
'hasAttachments' => true,
|
||||
] : [
|
||||
'message' => $this->message,
|
||||
'data' => $this->data,
|
||||
'hasAttachments' => false,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Marshal the object from its serialized data.
|
||||
*
|
||||
* @param array $data
|
||||
* @return void
|
||||
*/
|
||||
public function __unserialize(array $data)
|
||||
{
|
||||
if (isset($data['hasAttachments']) && $data['hasAttachments'] === true) {
|
||||
$this->message = unserialize(base64_decode($data['message']));
|
||||
$this->data = unserialize(base64_decode($data['data']));
|
||||
} else {
|
||||
$this->message = $data['message'];
|
||||
$this->data = $data['data'];
|
||||
}
|
||||
}
|
||||
}
|
||||
21
vendor/laravel/framework/src/Illuminate/Mail/LICENSE.md
vendored
Normal file
21
vendor/laravel/framework/src/Illuminate/Mail/LICENSE.md
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Taylor Otwell
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
468
vendor/laravel/framework/src/Illuminate/Mail/MailManager.php
vendored
Normal file
468
vendor/laravel/framework/src/Illuminate/Mail/MailManager.php
vendored
Normal file
@@ -0,0 +1,468 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Mail;
|
||||
|
||||
use Aws\Ses\SesClient;
|
||||
use Closure;
|
||||
use GuzzleHttp\Client as HttpClient;
|
||||
use Illuminate\Contracts\Mail\Factory as FactoryContract;
|
||||
use Illuminate\Log\LogManager;
|
||||
use Illuminate\Mail\Transport\ArrayTransport;
|
||||
use Illuminate\Mail\Transport\LogTransport;
|
||||
use Illuminate\Mail\Transport\MailgunTransport;
|
||||
use Illuminate\Mail\Transport\SesTransport;
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Support\Str;
|
||||
use InvalidArgumentException;
|
||||
use Postmark\ThrowExceptionOnFailurePlugin;
|
||||
use Postmark\Transport as PostmarkTransport;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Swift_DependencyContainer;
|
||||
use Swift_Mailer;
|
||||
use Swift_SendmailTransport as SendmailTransport;
|
||||
use Swift_SmtpTransport as SmtpTransport;
|
||||
|
||||
/**
|
||||
* @mixin \Illuminate\Mail\Mailer
|
||||
*/
|
||||
class MailManager implements FactoryContract
|
||||
{
|
||||
/**
|
||||
* The application instance.
|
||||
*
|
||||
* @var \Illuminate\Contracts\Foundation\Application
|
||||
*/
|
||||
protected $app;
|
||||
|
||||
/**
|
||||
* The array of resolved mailers.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $mailers = [];
|
||||
|
||||
/**
|
||||
* The registered custom driver creators.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $customCreators = [];
|
||||
|
||||
/**
|
||||
* Create a new Mail manager instance.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Foundation\Application $app
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($app)
|
||||
{
|
||||
$this->app = $app;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a mailer instance by name.
|
||||
*
|
||||
* @param string|null $name
|
||||
* @return \Illuminate\Mail\Mailer
|
||||
*/
|
||||
public function mailer($name = null)
|
||||
{
|
||||
$name = $name ?: $this->getDefaultDriver();
|
||||
|
||||
return $this->mailers[$name] = $this->get($name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a mailer driver instance.
|
||||
*
|
||||
* @param string|null $driver
|
||||
* @return \Illuminate\Mail\Mailer
|
||||
*/
|
||||
public function driver($driver = null)
|
||||
{
|
||||
return $this->mailer($driver);
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempt to get the mailer from the local cache.
|
||||
*
|
||||
* @param string $name
|
||||
* @return \Illuminate\Mail\Mailer
|
||||
*/
|
||||
protected function get($name)
|
||||
{
|
||||
return $this->mailers[$name] ?? $this->resolve($name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolve the given mailer.
|
||||
*
|
||||
* @param string $name
|
||||
* @return \Illuminate\Mail\Mailer
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
protected function resolve($name)
|
||||
{
|
||||
$config = $this->getConfig($name);
|
||||
|
||||
if (is_null($config)) {
|
||||
throw new InvalidArgumentException("Mailer [{$name}] is not defined.");
|
||||
}
|
||||
|
||||
// Once we have created 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(
|
||||
$name,
|
||||
$this->app['view'],
|
||||
$this->createSwiftMailer($config),
|
||||
$this->app['events']
|
||||
);
|
||||
|
||||
if ($this->app->bound('queue')) {
|
||||
$mailer->setQueue($this->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 these will be sent to a single email address.
|
||||
foreach (['from', 'reply_to', 'to', 'return_path'] as $type) {
|
||||
$this->setGlobalAddress($mailer, $config, $type);
|
||||
}
|
||||
|
||||
return $mailer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create the SwiftMailer instance for the given configuration.
|
||||
*
|
||||
* @param array $config
|
||||
* @return \Swift_Mailer
|
||||
*/
|
||||
protected function createSwiftMailer(array $config)
|
||||
{
|
||||
if ($config['domain'] ?? false) {
|
||||
Swift_DependencyContainer::getInstance()
|
||||
->register('mime.idgenerator.idright')
|
||||
->asValue($config['domain']);
|
||||
}
|
||||
|
||||
return new Swift_Mailer($this->createTransport($config));
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new transport instance.
|
||||
*
|
||||
* @param array $config
|
||||
* @return \Swift_Transport
|
||||
*/
|
||||
public function createTransport(array $config)
|
||||
{
|
||||
// Here we will check if the "transport" key exists and if it doesn't we will
|
||||
// assume an application is still using the legacy mail configuration file
|
||||
// format and use the "mail.driver" configuration option instead for BC.
|
||||
$transport = $config['transport'] ?? $this->app['config']['mail.driver'];
|
||||
|
||||
if (isset($this->customCreators[$transport])) {
|
||||
return call_user_func($this->customCreators[$transport], $config);
|
||||
}
|
||||
|
||||
if (trim($transport) === '' || ! method_exists($this, $method = 'create'.ucfirst($transport).'Transport')) {
|
||||
throw new InvalidArgumentException("Unsupported mail transport [{$transport}].");
|
||||
}
|
||||
|
||||
return $this->{$method}($config);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of the SMTP Swift Transport driver.
|
||||
*
|
||||
* @param array $config
|
||||
* @return \Swift_SmtpTransport
|
||||
*/
|
||||
protected function createSmtpTransport(array $config)
|
||||
{
|
||||
// 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 = new SmtpTransport(
|
||||
$config['host'],
|
||||
$config['port']
|
||||
);
|
||||
|
||||
if (! empty($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']);
|
||||
}
|
||||
|
||||
return $this->configureSmtpTransport($transport, $config);
|
||||
}
|
||||
|
||||
/**
|
||||
* Configure the additional SMTP driver options.
|
||||
*
|
||||
* @param \Swift_SmtpTransport $transport
|
||||
* @param array $config
|
||||
* @return \Swift_SmtpTransport
|
||||
*/
|
||||
protected function configureSmtpTransport($transport, array $config)
|
||||
{
|
||||
if (isset($config['stream'])) {
|
||||
$transport->setStreamOptions($config['stream']);
|
||||
}
|
||||
|
||||
if (isset($config['source_ip'])) {
|
||||
$transport->setSourceIp($config['source_ip']);
|
||||
}
|
||||
|
||||
if (isset($config['local_domain'])) {
|
||||
$transport->setLocalDomain($config['local_domain']);
|
||||
}
|
||||
|
||||
if (isset($config['timeout'])) {
|
||||
$transport->setTimeout($config['timeout']);
|
||||
}
|
||||
|
||||
if (isset($config['auth_mode'])) {
|
||||
$transport->setAuthMode($config['auth_mode']);
|
||||
}
|
||||
|
||||
return $transport;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of the Sendmail Swift Transport driver.
|
||||
*
|
||||
* @param array $config
|
||||
* @return \Swift_SendmailTransport
|
||||
*/
|
||||
protected function createSendmailTransport(array $config)
|
||||
{
|
||||
return new SendmailTransport(
|
||||
$config['path'] ?? $this->app['config']->get('mail.sendmail')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of the Amazon SES Swift Transport driver.
|
||||
*
|
||||
* @param array $config
|
||||
* @return \Illuminate\Mail\Transport\SesTransport
|
||||
*/
|
||||
protected function createSesTransport(array $config)
|
||||
{
|
||||
if (! isset($config['secret'])) {
|
||||
$config = array_merge($this->app['config']->get('services.ses', []), [
|
||||
'version' => 'latest', 'service' => 'email',
|
||||
]);
|
||||
}
|
||||
|
||||
$config = Arr::except($config, ['transport']);
|
||||
|
||||
return new SesTransport(
|
||||
new SesClient($this->addSesCredentials($config)),
|
||||
$config['options'] ?? []
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the SES credentials to the configuration array.
|
||||
*
|
||||
* @param array $config
|
||||
* @return array
|
||||
*/
|
||||
protected function addSesCredentials(array $config)
|
||||
{
|
||||
if (! empty($config['key']) && ! empty($config['secret'])) {
|
||||
$config['credentials'] = Arr::only($config, ['key', 'secret', 'token']);
|
||||
}
|
||||
|
||||
return $config;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of the Mail Swift Transport driver.
|
||||
*
|
||||
* @return \Swift_SendmailTransport
|
||||
*/
|
||||
protected function createMailTransport()
|
||||
{
|
||||
return new SendmailTransport;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of the Mailgun Swift Transport driver.
|
||||
*
|
||||
* @param array $config
|
||||
* @return \Illuminate\Mail\Transport\MailgunTransport
|
||||
*/
|
||||
protected function createMailgunTransport(array $config)
|
||||
{
|
||||
if (! isset($config['secret'])) {
|
||||
$config = $this->app['config']->get('services.mailgun', []);
|
||||
}
|
||||
|
||||
return new MailgunTransport(
|
||||
$this->guzzle($config),
|
||||
$config['secret'],
|
||||
$config['domain'],
|
||||
$config['endpoint'] ?? null
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of the Postmark Swift Transport driver.
|
||||
*
|
||||
* @param array $config
|
||||
* @return \Swift_Transport
|
||||
*/
|
||||
protected function createPostmarkTransport(array $config)
|
||||
{
|
||||
return tap(new PostmarkTransport(
|
||||
$config['token'] ?? $this->app['config']->get('services.postmark.token')
|
||||
), function ($transport) {
|
||||
$transport->registerPlugin(new ThrowExceptionOnFailurePlugin());
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of the Log Swift Transport driver.
|
||||
*
|
||||
* @param array $config
|
||||
* @return \Illuminate\Mail\Transport\LogTransport
|
||||
*/
|
||||
protected function createLogTransport(array $config)
|
||||
{
|
||||
$logger = $this->app->make(LoggerInterface::class);
|
||||
|
||||
if ($logger instanceof LogManager) {
|
||||
$logger = $logger->channel(
|
||||
$config['channel'] ?? $this->app['config']->get('mail.log_channel')
|
||||
);
|
||||
}
|
||||
|
||||
return new LogTransport($logger);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of the Array Swift Transport Driver.
|
||||
*
|
||||
* @return \Illuminate\Mail\Transport\ArrayTransport
|
||||
*/
|
||||
protected function createArrayTransport()
|
||||
{
|
||||
return new ArrayTransport;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a fresh Guzzle HTTP client instance.
|
||||
*
|
||||
* @param array $config
|
||||
* @return \GuzzleHttp\Client
|
||||
*/
|
||||
protected function guzzle(array $config)
|
||||
{
|
||||
return new HttpClient(Arr::add(
|
||||
$config['guzzle'] ?? [],
|
||||
'connect_timeout',
|
||||
60
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* 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, string $type)
|
||||
{
|
||||
$address = Arr::get($config, $type, $this->app['config']['mail.'.$type]);
|
||||
|
||||
if (is_array($address) && isset($address['address'])) {
|
||||
$mailer->{'always'.Str::studly($type)}($address['address'], $address['name']);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the mail connection configuration.
|
||||
*
|
||||
* @param string $name
|
||||
* @return array
|
||||
*/
|
||||
protected function getConfig(string $name)
|
||||
{
|
||||
// Here we will check if the "driver" key exists and if it does we will use
|
||||
// the entire mail configuration file as the "driver" config in order to
|
||||
// provide "BC" for any Laravel <= 6.x style mail configuration files.
|
||||
return $this->app['config']['mail.driver']
|
||||
? $this->app['config']['mail']
|
||||
: $this->app['config']["mail.mailers.{$name}"];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the default mail driver name.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDefaultDriver()
|
||||
{
|
||||
// Here we will check if the "driver" key exists and if it does we will use
|
||||
// that as the default driver in order to provide support for old styles
|
||||
// of the Laravel mail configuration file for backwards compatibility.
|
||||
return $this->app['config']['mail.driver'] ??
|
||||
$this->app['config']['mail.default'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the default mail driver name.
|
||||
*
|
||||
* @param string $name
|
||||
* @return void
|
||||
*/
|
||||
public function setDefaultDriver(string $name)
|
||||
{
|
||||
if ($this->app['config']['mail.driver']) {
|
||||
$this->app['config']['mail.driver'] = $name;
|
||||
}
|
||||
|
||||
$this->app['config']['mail.default'] = $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a custom transport creator Closure.
|
||||
*
|
||||
* @param string $driver
|
||||
* @param \Closure $callback
|
||||
* @return $this
|
||||
*/
|
||||
public function extend($driver, Closure $callback)
|
||||
{
|
||||
$this->customCreators[$driver] = $callback;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Dynamically call the default driver instance.
|
||||
*
|
||||
* @param string $method
|
||||
* @param array $parameters
|
||||
* @return mixed
|
||||
*/
|
||||
public function __call($method, $parameters)
|
||||
{
|
||||
return $this->mailer()->$method(...$parameters);
|
||||
}
|
||||
}
|
||||
73
vendor/laravel/framework/src/Illuminate/Mail/MailServiceProvider.php
vendored
Executable file
73
vendor/laravel/framework/src/Illuminate/Mail/MailServiceProvider.php
vendored
Executable file
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Mail;
|
||||
|
||||
use Illuminate\Contracts\Support\DeferrableProvider;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class MailServiceProvider extends ServiceProvider implements DeferrableProvider
|
||||
{
|
||||
/**
|
||||
* Register the service provider.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
$this->registerIlluminateMailer();
|
||||
$this->registerMarkdownRenderer();
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the Illuminate mailer instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function registerIlluminateMailer()
|
||||
{
|
||||
$this->app->singleton('mail.manager', function ($app) {
|
||||
return new MailManager($app);
|
||||
});
|
||||
|
||||
$this->app->bind('mailer', function ($app) {
|
||||
return $app->make('mail.manager')->mailer();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 [
|
||||
'mail.manager',
|
||||
'mailer',
|
||||
Markdown::class,
|
||||
];
|
||||
}
|
||||
}
|
||||
920
vendor/laravel/framework/src/Illuminate/Mail/Mailable.php
vendored
Normal file
920
vendor/laravel/framework/src/Illuminate/Mail/Mailable.php
vendored
Normal file
@@ -0,0 +1,920 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Mail;
|
||||
|
||||
use Illuminate\Container\Container;
|
||||
use Illuminate\Contracts\Filesystem\Factory as FilesystemFactory;
|
||||
use Illuminate\Contracts\Mail\Factory as MailFactory;
|
||||
use Illuminate\Contracts\Mail\Mailable as MailableContract;
|
||||
use Illuminate\Contracts\Queue\Factory as Queue;
|
||||
use Illuminate\Contracts\Support\Renderable;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\HtmlString;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Support\Traits\ForwardsCalls;
|
||||
use Illuminate\Support\Traits\Localizable;
|
||||
use ReflectionClass;
|
||||
use ReflectionProperty;
|
||||
|
||||
class Mailable implements MailableContract, Renderable
|
||||
{
|
||||
use ForwardsCalls, Localizable;
|
||||
|
||||
/**
|
||||
* The locale of the message.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $locale;
|
||||
|
||||
/**
|
||||
* 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 HTML to use for the message.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $html;
|
||||
|
||||
/**
|
||||
* 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 attachments from a storage disk.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $diskAttachments = [];
|
||||
|
||||
/**
|
||||
* The callbacks for the message.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $callbacks = [];
|
||||
|
||||
/**
|
||||
* The name of the theme that should be used when formatting the message.
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
public $theme;
|
||||
|
||||
/**
|
||||
* The name of the mailer that should send the message.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $mailer;
|
||||
|
||||
/**
|
||||
* The callback that should be invoked while building the view data.
|
||||
*
|
||||
* @var callable
|
||||
*/
|
||||
public static $viewDataCallback;
|
||||
|
||||
/**
|
||||
* Send the message using the given mailer.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Mail\Factory|\Illuminate\Contracts\Mail\Mailer $mailer
|
||||
* @return void
|
||||
*/
|
||||
public function send($mailer)
|
||||
{
|
||||
return $this->withLocale($this->locale, function () use ($mailer) {
|
||||
Container::getInstance()->call([$this, 'build']);
|
||||
|
||||
$mailer = $mailer instanceof MailFactory
|
||||
? $mailer->mailer($this->mailer)
|
||||
: $mailer;
|
||||
|
||||
return $mailer->send($this->buildView(), $this->buildViewData(), function ($message) {
|
||||
$this->buildFrom($message)
|
||||
->buildRecipients($message)
|
||||
->buildSubject($message)
|
||||
->runCallbacks($message)
|
||||
->buildAttachments($message);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Queue the message for sending.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Queue\Factory $queue
|
||||
* @return mixed
|
||||
*/
|
||||
public function queue(Queue $queue)
|
||||
{
|
||||
if (isset($this->delay)) {
|
||||
return $this->later($this->delay, $queue);
|
||||
}
|
||||
|
||||
$connection = property_exists($this, 'connection') ? $this->connection : null;
|
||||
|
||||
$queueName = property_exists($this, 'queue') ? $this->queue : null;
|
||||
|
||||
return $queue->connection($connection)->pushOn(
|
||||
$queueName ?: null, $this->newQueuedJob()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deliver the queued message after the given delay.
|
||||
*
|
||||
* @param \DateTimeInterface|\DateInterval|int $delay
|
||||
* @param \Illuminate\Contracts\Queue\Factory $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, $this->newQueuedJob()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Make the queued mailable job instance.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
protected function newQueuedJob()
|
||||
{
|
||||
return new SendQueuedMailable($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the mailable into a view.
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @throws \ReflectionException
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
return $this->withLocale($this->locale, function () {
|
||||
Container::getInstance()->call([$this, 'build']);
|
||||
|
||||
return Container::getInstance()->make('mailer')->render(
|
||||
$this->buildView(), $this->buildViewData()
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the view for the message.
|
||||
*
|
||||
* @return array|string
|
||||
*
|
||||
* @throws \ReflectionException
|
||||
*/
|
||||
protected function buildView()
|
||||
{
|
||||
if (isset($this->html)) {
|
||||
return array_filter([
|
||||
'html' => new HtmlString($this->html),
|
||||
'text' => $this->textView ?? null,
|
||||
]);
|
||||
}
|
||||
|
||||
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
|
||||
*
|
||||
* @throws \ReflectionException
|
||||
*/
|
||||
protected function buildMarkdownView()
|
||||
{
|
||||
$markdown = Container::getInstance()->make(Markdown::class);
|
||||
|
||||
if (isset($this->theme)) {
|
||||
$markdown->theme($this->theme);
|
||||
}
|
||||
|
||||
$data = $this->buildViewData();
|
||||
|
||||
return [
|
||||
'html' => $markdown->render($this->markdown, $data),
|
||||
'text' => $this->buildMarkdownText($markdown, $data),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the view data for the message.
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @throws \ReflectionException
|
||||
*/
|
||||
public function buildViewData()
|
||||
{
|
||||
$data = $this->viewData;
|
||||
|
||||
if (static::$viewDataCallback) {
|
||||
$data = array_merge($data, call_user_func(static::$viewDataCallback, $this));
|
||||
}
|
||||
|
||||
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 $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']
|
||||
);
|
||||
}
|
||||
|
||||
$this->buildDiskAttachments($message);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add all of the disk attachments to the message.
|
||||
*
|
||||
* @param \Illuminate\Mail\Message $message
|
||||
* @return void
|
||||
*/
|
||||
protected function buildDiskAttachments($message)
|
||||
{
|
||||
foreach ($this->diskAttachments as $attachment) {
|
||||
$storage = Container::getInstance()->make(
|
||||
FilesystemFactory::class
|
||||
)->disk($attachment['disk']);
|
||||
|
||||
$message->attachData(
|
||||
$storage->get($attachment['path']),
|
||||
$attachment['name'] ?? basename($attachment['path']),
|
||||
array_merge(['mime' => $storage->mimeType($attachment['path'])], $attachment['options'])
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 locale of the message.
|
||||
*
|
||||
* @param string $locale
|
||||
* @return $this
|
||||
*/
|
||||
public function locale($locale)
|
||||
{
|
||||
$this->locale = $locale;
|
||||
|
||||
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');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the given replyTo is set on the mailable.
|
||||
*
|
||||
* @param object|array|string $address
|
||||
* @param string|null $name
|
||||
* @return bool
|
||||
*/
|
||||
public function hasReplyTo($address, $name = null)
|
||||
{
|
||||
return $this->hasRecipient($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' => $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)) {
|
||||
if (array_values($recipient) === $recipient) {
|
||||
return (object) array_map(function ($email) {
|
||||
return compact('email');
|
||||
}, $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' => $expected->name ?? null,
|
||||
'address' => $expected->email,
|
||||
];
|
||||
|
||||
return collect($this->{$property})->contains(function ($actual) use ($expected) {
|
||||
if (! isset($expected['name'])) {
|
||||
return $actual['address'] == $expected['address'];
|
||||
}
|
||||
|
||||
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 rendered HTML content for the message.
|
||||
*
|
||||
* @param string $html
|
||||
* @return $this
|
||||
*/
|
||||
public function html($html)
|
||||
{
|
||||
$this->html = $html;
|
||||
|
||||
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 = collect($this->attachments)
|
||||
->push(compact('file', 'options'))
|
||||
->unique('file')
|
||||
->all();
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Attach a file to the message from storage.
|
||||
*
|
||||
* @param string $path
|
||||
* @param string|null $name
|
||||
* @param array $options
|
||||
* @return $this
|
||||
*/
|
||||
public function attachFromStorage($path, $name = null, array $options = [])
|
||||
{
|
||||
return $this->attachFromStorageDisk(null, $path, $name, $options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Attach a file to the message from storage.
|
||||
*
|
||||
* @param string $disk
|
||||
* @param string $path
|
||||
* @param string|null $name
|
||||
* @param array $options
|
||||
* @return $this
|
||||
*/
|
||||
public function attachFromStorageDisk($disk, $path, $name = null, array $options = [])
|
||||
{
|
||||
$this->diskAttachments = collect($this->diskAttachments)->push([
|
||||
'disk' => $disk,
|
||||
'path' => $path,
|
||||
'name' => $name ?? basename($path),
|
||||
'options' => $options,
|
||||
])->unique(function ($file) {
|
||||
return $file['name'].$file['disk'].$file['path'];
|
||||
})->all();
|
||||
|
||||
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 = collect($this->rawAttachments)
|
||||
->push(compact('data', 'name', 'options'))
|
||||
->unique(function ($file) {
|
||||
return $file['name'].$file['data'];
|
||||
})->all();
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the name of the mailer that should send the message.
|
||||
*
|
||||
* @param string $mailer
|
||||
* @return $this
|
||||
*/
|
||||
public function mailer($mailer)
|
||||
{
|
||||
$this->mailer = $mailer;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a callback to be called while building the view data.
|
||||
*
|
||||
* @param callable $callback
|
||||
* @return void
|
||||
*/
|
||||
public static function buildViewDataUsing(callable $callback)
|
||||
{
|
||||
static::$viewDataCallback = $callback;
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply the callback's message changes if the given "value" is true.
|
||||
*
|
||||
* @param mixed $value
|
||||
* @param callable $callback
|
||||
* @param mixed $default
|
||||
* @return mixed|$this
|
||||
*/
|
||||
public function when($value, $callback, $default = null)
|
||||
{
|
||||
if ($value) {
|
||||
return $callback($this, $value) ?: $this;
|
||||
} elseif ($default) {
|
||||
return $default($this, $value) ?: $this;
|
||||
}
|
||||
|
||||
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::camel(substr($method, 4)), $parameters[0]);
|
||||
}
|
||||
|
||||
static::throwBadMethodCallException($method);
|
||||
}
|
||||
}
|
||||
626
vendor/laravel/framework/src/Illuminate/Mail/Mailer.php
vendored
Executable file
626
vendor/laravel/framework/src/Illuminate/Mail/Mailer.php
vendored
Executable file
@@ -0,0 +1,626 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Mail;
|
||||
|
||||
use Illuminate\Contracts\Events\Dispatcher;
|
||||
use Illuminate\Contracts\Mail\Mailable as MailableContract;
|
||||
use Illuminate\Contracts\Mail\Mailer as MailerContract;
|
||||
use Illuminate\Contracts\Mail\MailQueue as MailQueueContract;
|
||||
use Illuminate\Contracts\Queue\Factory as QueueContract;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Contracts\Support\Htmlable;
|
||||
use Illuminate\Contracts\View\Factory;
|
||||
use Illuminate\Mail\Events\MessageSending;
|
||||
use Illuminate\Mail\Events\MessageSent;
|
||||
use Illuminate\Support\HtmlString;
|
||||
use Illuminate\Support\Traits\Macroable;
|
||||
use InvalidArgumentException;
|
||||
use Swift_Mailer;
|
||||
|
||||
class Mailer implements MailerContract, MailQueueContract
|
||||
{
|
||||
use Macroable;
|
||||
|
||||
/**
|
||||
* The name that is configured for the mailer.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $name;
|
||||
|
||||
/**
|
||||
* 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 return path address.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $returnPath;
|
||||
|
||||
/**
|
||||
* The global to address and name.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $to;
|
||||
|
||||
/**
|
||||
* The queue factory implementation.
|
||||
*
|
||||
* @var \Illuminate\Contracts\Queue\Factory
|
||||
*/
|
||||
protected $queue;
|
||||
|
||||
/**
|
||||
* Array of failed recipients.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $failedRecipients = [];
|
||||
|
||||
/**
|
||||
* Create a new Mailer instance.
|
||||
*
|
||||
* @param string $name
|
||||
* @param \Illuminate\Contracts\View\Factory $views
|
||||
* @param \Swift_Mailer $swift
|
||||
* @param \Illuminate\Contracts\Events\Dispatcher|null $events
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(string $name, Factory $views, Swift_Mailer $swift, Dispatcher $events = null)
|
||||
{
|
||||
$this->name = $name;
|
||||
$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 return path address.
|
||||
*
|
||||
* @param string $address
|
||||
* @return void
|
||||
*/
|
||||
public function alwaysReturnPath($address)
|
||||
{
|
||||
$this->returnPath = compact('address');
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 cc($users)
|
||||
{
|
||||
return (new PendingMail($this))->cc($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 with only an HTML part.
|
||||
*
|
||||
* @param string $html
|
||||
* @param mixed $callback
|
||||
* @return void
|
||||
*/
|
||||
public function html($html, $callback)
|
||||
{
|
||||
return $this->send(['html' => new HtmlString($html)], [], $callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a new message with 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 with 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);
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the given message as a view.
|
||||
*
|
||||
* @param string|array $view
|
||||
* @param array $data
|
||||
* @return string
|
||||
*/
|
||||
public function render($view, array $data = [])
|
||||
{
|
||||
// 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.
|
||||
[$view, $plain, $raw] = $this->parseView($view);
|
||||
|
||||
$data['message'] = $this->createMessage();
|
||||
|
||||
return $this->renderView($view ?: $plain, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a new message using a view.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Mail\Mailable|string|array $view
|
||||
* @param array $data
|
||||
* @param \Closure|string|null $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.
|
||||
[$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.
|
||||
$callback($message);
|
||||
|
||||
$this->addContent($message, $view, $plain, $raw, $data);
|
||||
|
||||
// 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->setGlobalToAndRemoveCcAndBcc($message);
|
||||
}
|
||||
|
||||
// Next we will determine if the message should be sent. 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, $data)) {
|
||||
$this->sendSwiftMessage($swiftMessage);
|
||||
|
||||
$this->dispatchSentEvent($message, $data);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Send the given mailable.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Mail\Mailable $mailable
|
||||
* @return mixed
|
||||
*/
|
||||
protected function sendMailable(MailableContract $mailable)
|
||||
{
|
||||
return $mailable instanceof ShouldQueue
|
||||
? $mailable->mailer($this->name)->queue($this->queue)
|
||||
: $mailable->mailer($this->name)->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 it should contain both views with numerical 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 [
|
||||
$view['html'] ?? null,
|
||||
$view['text'] ?? null,
|
||||
$view['raw'] ?? null,
|
||||
];
|
||||
}
|
||||
|
||||
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 setGlobalToAndRemoveCcAndBcc($message)
|
||||
{
|
||||
$message->to($this->to['address'], $this->to['name'], true);
|
||||
$message->cc(null, null, true);
|
||||
$message->bcc(null, null, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Queue a new e-mail message for sending.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Mail\Mailable|string|array $view
|
||||
* @param string|null $queue
|
||||
* @return mixed
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function queue($view, $queue = null)
|
||||
{
|
||||
if (! $view instanceof MailableContract) {
|
||||
throw new InvalidArgumentException('Only mailables may be queued.');
|
||||
}
|
||||
|
||||
if (is_string($queue)) {
|
||||
$view->onQueue($queue);
|
||||
}
|
||||
|
||||
return $view->mailer($this->name)->queue($this->queue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Queue a new e-mail message for sending on the given queue.
|
||||
*
|
||||
* @param string $queue
|
||||
* @param \Illuminate\Contracts\Mail\Mailable $view
|
||||
* @return mixed
|
||||
*/
|
||||
public function onQueue($queue, $view)
|
||||
{
|
||||
return $this->queue($view, $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 \Illuminate\Contracts\Mail\Mailable $view
|
||||
* @return mixed
|
||||
*/
|
||||
public function queueOn($queue, $view)
|
||||
{
|
||||
return $this->onQueue($queue, $view);
|
||||
}
|
||||
|
||||
/**
|
||||
* Queue a new e-mail message for sending after (n) seconds.
|
||||
*
|
||||
* @param \DateTimeInterface|\DateInterval|int $delay
|
||||
* @param \Illuminate\Contracts\Mail\Mailable $view
|
||||
* @param string|null $queue
|
||||
* @return mixed
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function later($delay, $view, $queue = null)
|
||||
{
|
||||
if (! $view instanceof MailableContract) {
|
||||
throw new InvalidArgumentException('Only mailables may be queued.');
|
||||
}
|
||||
|
||||
return $view->mailer($this->name)->later(
|
||||
$delay, is_null($queue) ? $this->queue : $queue
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Queue a new e-mail message for sending after (n) seconds on the given queue.
|
||||
*
|
||||
* @param string $queue
|
||||
* @param \DateTimeInterface|\DateInterval|int $delay
|
||||
* @param \Illuminate\Contracts\Mail\Mailable $view
|
||||
* @return mixed
|
||||
*/
|
||||
public function laterOn($queue, $delay, $view)
|
||||
{
|
||||
return $this->later($delay, $view, $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
|
||||
// instance so the developer does not have to repeat themselves every time
|
||||
// they create a new message. We'll just go ahead and push this 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
|
||||
// instance so the developer does not have to repeat themselves every time
|
||||
// they create a new message. We will just go ahead and push this address.
|
||||
if (! empty($this->replyTo['address'])) {
|
||||
$message->replyTo($this->replyTo['address'], $this->replyTo['name']);
|
||||
}
|
||||
|
||||
if (! empty($this->returnPath['address'])) {
|
||||
$message->returnPath($this->returnPath['address']);
|
||||
}
|
||||
|
||||
return $message;
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a Swift Message instance.
|
||||
*
|
||||
* @param \Swift_Message $message
|
||||
* @return int|null
|
||||
*/
|
||||
protected function sendSwiftMessage($message)
|
||||
{
|
||||
$this->failedRecipients = [];
|
||||
|
||||
try {
|
||||
return $this->swift->send($message, $this->failedRecipients);
|
||||
} finally {
|
||||
$this->forceReconnection();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if the message can be sent.
|
||||
*
|
||||
* @param \Swift_Message $message
|
||||
* @param array $data
|
||||
* @return bool
|
||||
*/
|
||||
protected function shouldSendMessage($message, $data = [])
|
||||
{
|
||||
if (! $this->events) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return $this->events->until(
|
||||
new MessageSending($message, $data)
|
||||
) !== false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Dispatch the message sent event.
|
||||
*
|
||||
* @param \Illuminate\Mail\Message $message
|
||||
* @param array $data
|
||||
* @return void
|
||||
*/
|
||||
protected function dispatchSentEvent($message, $data = [])
|
||||
{
|
||||
if ($this->events) {
|
||||
$this->events->dispatch(
|
||||
new MessageSent($message->getSwiftMessage(), $data)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 array of failed recipients.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function failures()
|
||||
{
|
||||
return $this->failedRecipients;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Swift Mailer instance.
|
||||
*
|
||||
* @return \Swift_Mailer
|
||||
*/
|
||||
public function getSwiftMailer()
|
||||
{
|
||||
return $this->swift;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the view factory instance.
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\Factory
|
||||
*/
|
||||
public function getViewFactory()
|
||||
{
|
||||
return $this->views;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
}
|
||||
173
vendor/laravel/framework/src/Illuminate/Mail/Markdown.php
vendored
Normal file
173
vendor/laravel/framework/src/Illuminate/Mail/Markdown.php
vendored
Normal file
@@ -0,0 +1,173 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Mail;
|
||||
|
||||
use Illuminate\Contracts\View\Factory as ViewFactory;
|
||||
use Illuminate\Support\HtmlString;
|
||||
use Illuminate\Support\Str;
|
||||
use League\CommonMark\CommonMarkConverter;
|
||||
use League\CommonMark\Environment;
|
||||
use League\CommonMark\Extension\Table\TableExtension;
|
||||
use TijsVerkoyen\CssToInlineStyles\CssToInlineStyles;
|
||||
|
||||
class Markdown
|
||||
{
|
||||
/**
|
||||
* The view factory implementation.
|
||||
*
|
||||
* @var \Illuminate\Contracts\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 = $options['theme'] ?? 'default';
|
||||
$this->loadComponentsFrom($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();
|
||||
|
||||
$theme = Str::contains($this->theme, '::')
|
||||
? $this->theme
|
||||
: 'mail::themes.'.$this->theme;
|
||||
|
||||
return new HtmlString(($inliner ?: new CssToInlineStyles)->convert(
|
||||
$contents, $this->view->make($theme, $data)->render()
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the Markdown template into text.
|
||||
*
|
||||
* @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->textComponentPaths()
|
||||
)->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 \Illuminate\Support\HtmlString
|
||||
*/
|
||||
public static function parse($text)
|
||||
{
|
||||
$environment = Environment::createCommonMarkEnvironment();
|
||||
|
||||
$environment->addExtension(new TableExtension);
|
||||
|
||||
$converter = new CommonMarkConverter([
|
||||
'allow_unsafe_links' => false,
|
||||
], $environment);
|
||||
|
||||
return new HtmlString($converter->convertToHtml($text));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the HTML component paths.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function htmlComponentPaths()
|
||||
{
|
||||
return array_map(function ($path) {
|
||||
return $path.'/html';
|
||||
}, $this->componentPaths());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the text component paths.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function textComponentPaths()
|
||||
{
|
||||
return array_map(function ($path) {
|
||||
return $path.'/text';
|
||||
}, $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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the default theme to be used.
|
||||
*
|
||||
* @param string $theme
|
||||
* @return $this
|
||||
*/
|
||||
public function theme($theme)
|
||||
{
|
||||
$this->theme = $theme;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
329
vendor/laravel/framework/src/Illuminate/Mail/Message.php
vendored
Executable file
329
vendor/laravel/framework/src/Illuminate/Mail/Message.php
vendored
Executable file
@@ -0,0 +1,329 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Mail;
|
||||
|
||||
use Illuminate\Support\Traits\ForwardsCalls;
|
||||
use Swift_Attachment;
|
||||
use Swift_Image;
|
||||
|
||||
/**
|
||||
* @mixin \Swift_Message
|
||||
*/
|
||||
class Message
|
||||
{
|
||||
use ForwardsCalls;
|
||||
|
||||
/**
|
||||
* 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_Mime_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 new Swift_Attachment($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 = new Swift_Image($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)
|
||||
{
|
||||
return $this->forwardCallTo($this->swift, $method, $parameters);
|
||||
}
|
||||
}
|
||||
176
vendor/laravel/framework/src/Illuminate/Mail/PendingMail.php
vendored
Normal file
176
vendor/laravel/framework/src/Illuminate/Mail/PendingMail.php
vendored
Normal file
@@ -0,0 +1,176 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Mail;
|
||||
|
||||
use Illuminate\Contracts\Mail\Mailable as MailableContract;
|
||||
use Illuminate\Contracts\Mail\Mailer as MailerContract;
|
||||
use Illuminate\Contracts\Translation\HasLocalePreference;
|
||||
|
||||
class PendingMail
|
||||
{
|
||||
/**
|
||||
* The mailer instance.
|
||||
*
|
||||
* @var \Illuminate\Contracts\Mail\Mailer
|
||||
*/
|
||||
protected $mailer;
|
||||
|
||||
/**
|
||||
* The locale of the message.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $locale;
|
||||
|
||||
/**
|
||||
* 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 \Illuminate\Contracts\Mail\Mailer $mailer
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(MailerContract $mailer)
|
||||
{
|
||||
$this->mailer = $mailer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the locale of the message.
|
||||
*
|
||||
* @param string $locale
|
||||
* @return $this
|
||||
*/
|
||||
public function locale($locale)
|
||||
{
|
||||
$this->locale = $locale;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the recipients of the message.
|
||||
*
|
||||
* @param mixed $users
|
||||
* @return $this
|
||||
*/
|
||||
public function to($users)
|
||||
{
|
||||
$this->to = $users;
|
||||
|
||||
if (! $this->locale && $users instanceof HasLocalePreference) {
|
||||
$this->locale($users->preferredLocale());
|
||||
}
|
||||
|
||||
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 \Illuminate\Contracts\Mail\Mailable $mailable
|
||||
* @return mixed
|
||||
*/
|
||||
public function send(MailableContract $mailable)
|
||||
{
|
||||
return $this->mailer->send($this->fill($mailable));
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a mailable message immediately.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Mail\Mailable $mailable
|
||||
* @return mixed
|
||||
*
|
||||
* @deprecated Use send() instead.
|
||||
*/
|
||||
public function sendNow(MailableContract $mailable)
|
||||
{
|
||||
return $this->mailer->send($this->fill($mailable));
|
||||
}
|
||||
|
||||
/**
|
||||
* Push the given mailable onto the queue.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Mail\Mailable $mailable
|
||||
* @return mixed
|
||||
*/
|
||||
public function queue(MailableContract $mailable)
|
||||
{
|
||||
return $this->mailer->queue($this->fill($mailable));
|
||||
}
|
||||
|
||||
/**
|
||||
* Deliver the queued message after the given delay.
|
||||
*
|
||||
* @param \DateTimeInterface|\DateInterval|int $delay
|
||||
* @param \Illuminate\Contracts\Mail\Mailable $mailable
|
||||
* @return mixed
|
||||
*/
|
||||
public function later($delay, MailableContract $mailable)
|
||||
{
|
||||
return $this->mailer->later($delay, $this->fill($mailable));
|
||||
}
|
||||
|
||||
/**
|
||||
* Populate the mailable with the addresses.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Mail\Mailable $mailable
|
||||
* @return \Illuminate\Mail\Mailable
|
||||
*/
|
||||
protected function fill(MailableContract $mailable)
|
||||
{
|
||||
return tap($mailable->to($this->to)
|
||||
->cc($this->cc)
|
||||
->bcc($this->bcc), function (MailableContract $mailable) {
|
||||
if ($this->locale) {
|
||||
$mailable->locale($this->locale);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
101
vendor/laravel/framework/src/Illuminate/Mail/SendQueuedMailable.php
vendored
Normal file
101
vendor/laravel/framework/src/Illuminate/Mail/SendQueuedMailable.php
vendored
Normal file
@@ -0,0 +1,101 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Mail;
|
||||
|
||||
use Illuminate\Contracts\Mail\Factory as MailFactory;
|
||||
use Illuminate\Contracts\Mail\Mailable as MailableContract;
|
||||
|
||||
class SendQueuedMailable
|
||||
{
|
||||
/**
|
||||
* The mailable message instance.
|
||||
*
|
||||
* @var \Illuminate\Contracts\Mail\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\Factory $factory
|
||||
* @return void
|
||||
*/
|
||||
public function handle(MailFactory $factory)
|
||||
{
|
||||
$this->mailable->send($factory);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the display name for the queued job.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function displayName()
|
||||
{
|
||||
return get_class($this->mailable);
|
||||
}
|
||||
|
||||
/**
|
||||
* Call the failed method on the mailable instance.
|
||||
*
|
||||
* @param \Throwable $e
|
||||
* @return void
|
||||
*/
|
||||
public function failed($e)
|
||||
{
|
||||
if (method_exists($this->mailable, 'failed')) {
|
||||
$this->mailable->failed($e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the retry delay for the mailable object.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function retryAfter()
|
||||
{
|
||||
if (! method_exists($this->mailable, 'retryAfter') && ! isset($this->mailable->retryAfter)) {
|
||||
return;
|
||||
}
|
||||
|
||||
return $this->mailable->retryAfter ?? $this->mailable->retryAfter();
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare the instance for cloning.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __clone()
|
||||
{
|
||||
$this->mailable = clone $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 Illuminate\Support\Collection;
|
||||
use Swift_Mime_SimpleMessage;
|
||||
|
||||
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_SimpleMessage $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;
|
||||
}
|
||||
}
|
||||
69
vendor/laravel/framework/src/Illuminate/Mail/Transport/LogTransport.php
vendored
Normal file
69
vendor/laravel/framework/src/Illuminate/Mail/Transport/LogTransport.php
vendored
Normal file
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Mail\Transport;
|
||||
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Swift_Mime_SimpleMessage;
|
||||
use Swift_Mime_SimpleMimeEntity;
|
||||
|
||||
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_SimpleMessage $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_SimpleMimeEntity $entity
|
||||
* @return string
|
||||
*/
|
||||
protected function getMimeEntityString(Swift_Mime_SimpleMimeEntity $entity)
|
||||
{
|
||||
$string = (string) $entity->getHeaders().PHP_EOL.$entity->getBody();
|
||||
|
||||
foreach ($entity->getChildren() as $children) {
|
||||
$string .= PHP_EOL.PHP_EOL.$this->getMimeEntityString($children);
|
||||
}
|
||||
|
||||
return $string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the logger for the LogTransport instance.
|
||||
*
|
||||
* @return \Psr\Log\LoggerInterface
|
||||
*/
|
||||
public function logger()
|
||||
{
|
||||
return $this->logger;
|
||||
}
|
||||
}
|
||||
215
vendor/laravel/framework/src/Illuminate/Mail/Transport/MailgunTransport.php
vendored
Normal file
215
vendor/laravel/framework/src/Illuminate/Mail/Transport/MailgunTransport.php
vendored
Normal file
@@ -0,0 +1,215 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Mail\Transport;
|
||||
|
||||
use GuzzleHttp\ClientInterface;
|
||||
use Swift_Mime_SimpleMessage;
|
||||
|
||||
class MailgunTransport extends Transport
|
||||
{
|
||||
/**
|
||||
* Guzzle client instance.
|
||||
*
|
||||
* @var \GuzzleHttp\ClientInterface
|
||||
*/
|
||||
protected $client;
|
||||
|
||||
/**
|
||||
* The Mailgun API key.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $key;
|
||||
|
||||
/**
|
||||
* The Mailgun email domain.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $domain;
|
||||
|
||||
/**
|
||||
* The Mailgun API endpoint.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $endpoint;
|
||||
|
||||
/**
|
||||
* Create a new Mailgun transport instance.
|
||||
*
|
||||
* @param \GuzzleHttp\ClientInterface $client
|
||||
* @param string $key
|
||||
* @param string $domain
|
||||
* @param string|null $endpoint
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(ClientInterface $client, $key, $domain, $endpoint = null)
|
||||
{
|
||||
$this->key = $key;
|
||||
$this->client = $client;
|
||||
$this->endpoint = $endpoint ?? 'api.mailgun.net';
|
||||
|
||||
$this->setDomain($domain);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function send(Swift_Mime_SimpleMessage $message, &$failedRecipients = null)
|
||||
{
|
||||
$this->beforeSendPerformed($message);
|
||||
|
||||
$to = $this->getTo($message);
|
||||
|
||||
$bcc = $message->getBcc();
|
||||
|
||||
$message->setBcc([]);
|
||||
|
||||
$response = $this->client->request(
|
||||
'POST',
|
||||
"https://{$this->endpoint}/v3/{$this->domain}/messages.mime",
|
||||
$this->payload($message, $to)
|
||||
);
|
||||
|
||||
$message->getHeaders()->addTextHeader(
|
||||
'X-Mailgun-Message-ID', $this->getMessageId($response)
|
||||
);
|
||||
|
||||
$message->setBcc($bcc);
|
||||
|
||||
$this->sendPerformed($message);
|
||||
|
||||
return $this->numberOfRecipients($message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the HTTP payload for sending the Mailgun message.
|
||||
*
|
||||
* @param \Swift_Mime_SimpleMessage $message
|
||||
* @param string $to
|
||||
* @return array
|
||||
*/
|
||||
protected function payload(Swift_Mime_SimpleMessage $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_SimpleMessage $message
|
||||
* @return string
|
||||
*/
|
||||
protected function getTo(Swift_Mime_SimpleMessage $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_SimpleMessage $message
|
||||
* @return array
|
||||
*/
|
||||
protected function allContacts(Swift_Mime_SimpleMessage $message)
|
||||
{
|
||||
return array_merge(
|
||||
(array) $message->getTo(), (array) $message->getCc(), (array) $message->getBcc()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the message ID from the response.
|
||||
*
|
||||
* @param \Psr\Http\Message\ResponseInterface $response
|
||||
* @return string
|
||||
*/
|
||||
protected function getMessageId($response)
|
||||
{
|
||||
return object_get(
|
||||
json_decode($response->getBody()->getContents()), '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 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 string
|
||||
*/
|
||||
public function setDomain($domain)
|
||||
{
|
||||
return $this->domain = $domain;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the API endpoint being used by the transport.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getEndpoint()
|
||||
{
|
||||
return $this->endpoint;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the API endpoint being used by the transport.
|
||||
*
|
||||
* @param string $endpoint
|
||||
* @return string
|
||||
*/
|
||||
public function setEndpoint($endpoint)
|
||||
{
|
||||
return $this->endpoint = $endpoint;
|
||||
}
|
||||
}
|
||||
92
vendor/laravel/framework/src/Illuminate/Mail/Transport/SesTransport.php
vendored
Normal file
92
vendor/laravel/framework/src/Illuminate/Mail/Transport/SesTransport.php
vendored
Normal file
@@ -0,0 +1,92 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Mail\Transport;
|
||||
|
||||
use Aws\Ses\SesClient;
|
||||
use Swift_Mime_SimpleMessage;
|
||||
|
||||
class SesTransport extends Transport
|
||||
{
|
||||
/**
|
||||
* The Amazon SES instance.
|
||||
*
|
||||
* @var \Aws\Ses\SesClient
|
||||
*/
|
||||
protected $ses;
|
||||
|
||||
/**
|
||||
* The Amazon SES transmission options.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $options = [];
|
||||
|
||||
/**
|
||||
* Create a new SES transport instance.
|
||||
*
|
||||
* @param \Aws\Ses\SesClient $ses
|
||||
* @param array $options
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(SesClient $ses, $options = [])
|
||||
{
|
||||
$this->ses = $ses;
|
||||
$this->options = $options;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function send(Swift_Mime_SimpleMessage $message, &$failedRecipients = null)
|
||||
{
|
||||
$this->beforeSendPerformed($message);
|
||||
|
||||
$result = $this->ses->sendRawEmail(
|
||||
array_merge(
|
||||
$this->options, [
|
||||
'Source' => key($message->getSender() ?: $message->getFrom()),
|
||||
'RawMessage' => [
|
||||
'Data' => $message->toString(),
|
||||
],
|
||||
]
|
||||
)
|
||||
);
|
||||
|
||||
$message->getHeaders()->addTextHeader('X-SES-Message-ID', $result->get('MessageId'));
|
||||
|
||||
$this->sendPerformed($message);
|
||||
|
||||
return $this->numberOfRecipients($message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Amazon SES client for the SesTransport instance.
|
||||
*
|
||||
* @return \Aws\Ses\SesClient
|
||||
*/
|
||||
public function ses()
|
||||
{
|
||||
return $this->ses;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the transmission options being used by the transport.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
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;
|
||||
}
|
||||
}
|
||||
108
vendor/laravel/framework/src/Illuminate/Mail/Transport/Transport.php
vendored
Normal file
108
vendor/laravel/framework/src/Illuminate/Mail/Transport/Transport.php
vendored
Normal file
@@ -0,0 +1,108 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Mail\Transport;
|
||||
|
||||
use Swift_Events_EventListener;
|
||||
use Swift_Events_SendEvent;
|
||||
use Swift_Mime_SimpleMessage;
|
||||
use Swift_Transport;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function ping()
|
||||
{
|
||||
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_SimpleMessage $message
|
||||
* @return void
|
||||
*/
|
||||
protected function beforeSendPerformed(Swift_Mime_SimpleMessage $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_SimpleMessage $message
|
||||
* @return void
|
||||
*/
|
||||
protected function sendPerformed(Swift_Mime_SimpleMessage $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_SimpleMessage $message
|
||||
* @return int
|
||||
*/
|
||||
protected function numberOfRecipients(Swift_Mime_SimpleMessage $message)
|
||||
{
|
||||
return count(array_merge(
|
||||
(array) $message->getTo(), (array) $message->getCc(), (array) $message->getBcc()
|
||||
));
|
||||
}
|
||||
}
|
||||
46
vendor/laravel/framework/src/Illuminate/Mail/composer.json
vendored
Executable file
46
vendor/laravel/framework/src/Illuminate/Mail/composer.json
vendored
Executable file
@@ -0,0 +1,46 @@
|
||||
{
|
||||
"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": "^7.2.5|^8.0",
|
||||
"ext-json": "*",
|
||||
"illuminate/container": "^7.0",
|
||||
"illuminate/contracts": "^7.0",
|
||||
"illuminate/support": "^7.0",
|
||||
"league/commonmark": "^1.3",
|
||||
"psr/log": "^1.0",
|
||||
"swiftmailer/swiftmailer": "^6.0",
|
||||
"tijsverkoyen/css-to-inline-styles": "^2.2.2"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Illuminate\\Mail\\": ""
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "7.x-dev"
|
||||
}
|
||||
},
|
||||
"suggest": {
|
||||
"aws/aws-sdk-php": "Required to use the SES mail driver (^3.155).",
|
||||
"guzzlehttp/guzzle": "Required to use the Mailgun mail driver (^6.3.1|^7.0.1).",
|
||||
"wildbit/swiftmailer-postmark": "Required to use Postmark mail driver (^3.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" role="presentation">
|
||||
<tr>
|
||||
<td align="center">
|
||||
<table width="100%" border="0" cellpadding="0" cellspacing="0" role="presentation">
|
||||
<tr>
|
||||
<td align="center">
|
||||
<table border="0" cellpadding="0" cellspacing="0" role="presentation">
|
||||
<tr>
|
||||
<td>
|
||||
<a href="{{ $url }}" class="button button-{{ $color ?? 'primary' }}" target="_blank" rel="noopener">{{ $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" role="presentation">
|
||||
<tr>
|
||||
<td class="content-cell" align="center">
|
||||
{{ Illuminate\Mail\Markdown::parse($slot) }}
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
11
vendor/laravel/framework/src/Illuminate/Mail/resources/views/html/header.blade.php
vendored
Normal file
11
vendor/laravel/framework/src/Illuminate/Mail/resources/views/html/header.blade.php
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
<tr>
|
||||
<td class="header">
|
||||
<a href="{{ $url }}" style="display: inline-block;">
|
||||
@if (trim($slot) === 'Laravel')
|
||||
<img src="https://laravel.com/img/notification-logo.png" class="logo" alt="Laravel Logo">
|
||||
@else
|
||||
{{ $slot }}
|
||||
@endif
|
||||
</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" role="presentation">
|
||||
<tr>
|
||||
<td align="center">
|
||||
<table class="content" width="100%" cellpadding="0" cellspacing="0" role="presentation">
|
||||
{{ $header ?? '' }}
|
||||
|
||||
<!-- Email Body -->
|
||||
<tr>
|
||||
<td class="body" width="100%" cellpadding="0" cellspacing="0">
|
||||
<table class="inner-body" align="center" width="570" cellpadding="0" cellspacing="0" role="presentation">
|
||||
<!-- Body content -->
|
||||
<tr>
|
||||
<td class="content-cell">
|
||||
{{ Illuminate\Mail\Markdown::parse($slot) }}
|
||||
|
||||
{{ $subcopy ?? '' }}
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
{{ $footer ?? '' }}
|
||||
</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') }}. @lang('All rights reserved.')
|
||||
@endcomponent
|
||||
@endslot
|
||||
@endcomponent
|
||||
14
vendor/laravel/framework/src/Illuminate/Mail/resources/views/html/panel.blade.php
vendored
Normal file
14
vendor/laravel/framework/src/Illuminate/Mail/resources/views/html/panel.blade.php
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
<table class="panel" width="100%" cellpadding="0" cellspacing="0" role="presentation">
|
||||
<tr>
|
||||
<td class="panel-content">
|
||||
<table width="100%" cellpadding="0" cellspacing="0" role="presentation">
|
||||
<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/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" role="presentation">
|
||||
<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>
|
||||
289
vendor/laravel/framework/src/Illuminate/Mail/resources/views/html/themes/default.css
vendored
Normal file
289
vendor/laravel/framework/src/Illuminate/Mail/resources/views/html/themes/default.css
vendored
Normal file
@@ -0,0 +1,289 @@
|
||||
/* Base */
|
||||
|
||||
body,
|
||||
body *:not(html):not(style):not(br):not(tr):not(code) {
|
||||
box-sizing: border-box;
|
||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif,
|
||||
'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';
|
||||
position: relative;
|
||||
}
|
||||
|
||||
body {
|
||||
-webkit-text-size-adjust: none;
|
||||
background-color: #ffffff;
|
||||
color: #718096;
|
||||
height: 100%;
|
||||
line-height: 1.4;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
width: 100% !important;
|
||||
}
|
||||
|
||||
p,
|
||||
ul,
|
||||
ol,
|
||||
blockquote {
|
||||
line-height: 1.4;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
a {
|
||||
color: #3869d4;
|
||||
}
|
||||
|
||||
a img {
|
||||
border: none;
|
||||
}
|
||||
|
||||
/* Typography */
|
||||
|
||||
h1 {
|
||||
color: #3d4852;
|
||||
font-size: 18px;
|
||||
font-weight: bold;
|
||||
margin-top: 0;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-size: 16px;
|
||||
font-weight: bold;
|
||||
margin-top: 0;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
h3 {
|
||||
font-size: 14px;
|
||||
font-weight: bold;
|
||||
margin-top: 0;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
p {
|
||||
font-size: 16px;
|
||||
line-height: 1.5em;
|
||||
margin-top: 0;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
p.sub {
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
img {
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
/* Layout */
|
||||
|
||||
.wrapper {
|
||||
-premailer-cellpadding: 0;
|
||||
-premailer-cellspacing: 0;
|
||||
-premailer-width: 100%;
|
||||
background-color: #edf2f7;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.content {
|
||||
-premailer-cellpadding: 0;
|
||||
-premailer-cellspacing: 0;
|
||||
-premailer-width: 100%;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
/* Header */
|
||||
|
||||
.header {
|
||||
padding: 25px 0;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.header a {
|
||||
color: #3d4852;
|
||||
font-size: 19px;
|
||||
font-weight: bold;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
/* Logo */
|
||||
|
||||
.logo {
|
||||
height: 75px;
|
||||
width: 75px;
|
||||
}
|
||||
|
||||
/* Body */
|
||||
|
||||
.body {
|
||||
-premailer-cellpadding: 0;
|
||||
-premailer-cellspacing: 0;
|
||||
-premailer-width: 100%;
|
||||
background-color: #edf2f7;
|
||||
border-bottom: 1px solid #edf2f7;
|
||||
border-top: 1px solid #edf2f7;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.inner-body {
|
||||
-premailer-cellpadding: 0;
|
||||
-premailer-cellspacing: 0;
|
||||
-premailer-width: 570px;
|
||||
background-color: #ffffff;
|
||||
border-color: #e8e5ef;
|
||||
border-radius: 2px;
|
||||
border-width: 1px;
|
||||
box-shadow: 0 2px 0 rgba(0, 0, 150, 0.025), 2px 4px 0 rgba(0, 0, 150, 0.015);
|
||||
margin: 0 auto;
|
||||
padding: 0;
|
||||
width: 570px;
|
||||
}
|
||||
|
||||
/* Subcopy */
|
||||
|
||||
.subcopy {
|
||||
border-top: 1px solid #e8e5ef;
|
||||
margin-top: 25px;
|
||||
padding-top: 25px;
|
||||
}
|
||||
|
||||
.subcopy p {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
/* Footer */
|
||||
|
||||
.footer {
|
||||
-premailer-cellpadding: 0;
|
||||
-premailer-cellspacing: 0;
|
||||
-premailer-width: 570px;
|
||||
margin: 0 auto;
|
||||
padding: 0;
|
||||
text-align: center;
|
||||
width: 570px;
|
||||
}
|
||||
|
||||
.footer p {
|
||||
color: #b0adc5;
|
||||
font-size: 12px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.footer a {
|
||||
color: #b0adc5;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
/* Tables */
|
||||
|
||||
.table table {
|
||||
-premailer-cellpadding: 0;
|
||||
-premailer-cellspacing: 0;
|
||||
-premailer-width: 100%;
|
||||
margin: 30px auto;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.table th {
|
||||
border-bottom: 1px solid #edeff2;
|
||||
margin: 0;
|
||||
padding-bottom: 8px;
|
||||
}
|
||||
|
||||
.table td {
|
||||
color: #74787e;
|
||||
font-size: 15px;
|
||||
line-height: 18px;
|
||||
margin: 0;
|
||||
padding: 10px 0;
|
||||
}
|
||||
|
||||
.content-cell {
|
||||
max-width: 100vw;
|
||||
padding: 32px;
|
||||
}
|
||||
|
||||
/* Buttons */
|
||||
|
||||
.action {
|
||||
-premailer-cellpadding: 0;
|
||||
-premailer-cellspacing: 0;
|
||||
-premailer-width: 100%;
|
||||
margin: 30px auto;
|
||||
padding: 0;
|
||||
text-align: center;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.button {
|
||||
-webkit-text-size-adjust: none;
|
||||
border-radius: 4px;
|
||||
color: #fff;
|
||||
display: inline-block;
|
||||
overflow: hidden;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.button-blue,
|
||||
.button-primary {
|
||||
background-color: #2d3748;
|
||||
border-bottom: 8px solid #2d3748;
|
||||
border-left: 18px solid #2d3748;
|
||||
border-right: 18px solid #2d3748;
|
||||
border-top: 8px solid #2d3748;
|
||||
}
|
||||
|
||||
.button-green,
|
||||
.button-success {
|
||||
background-color: #48bb78;
|
||||
border-bottom: 8px solid #48bb78;
|
||||
border-left: 18px solid #48bb78;
|
||||
border-right: 18px solid #48bb78;
|
||||
border-top: 8px solid #48bb78;
|
||||
}
|
||||
|
||||
.button-red,
|
||||
.button-error {
|
||||
background-color: #e53e3e;
|
||||
border-bottom: 8px solid #e53e3e;
|
||||
border-left: 18px solid #e53e3e;
|
||||
border-right: 18px solid #e53e3e;
|
||||
border-top: 8px solid #e53e3e;
|
||||
}
|
||||
|
||||
/* Panels */
|
||||
|
||||
.panel {
|
||||
border-left: #2d3748 solid 4px;
|
||||
margin: 21px 0;
|
||||
}
|
||||
|
||||
.panel-content {
|
||||
background-color: #edf2f7;
|
||||
color: #718096;
|
||||
padding: 16px;
|
||||
}
|
||||
|
||||
.panel-content p {
|
||||
color: #718096;
|
||||
}
|
||||
|
||||
.panel-item {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.panel-item p:last-of-type {
|
||||
margin-bottom: 0;
|
||||
padding-bottom: 0;
|
||||
}
|
||||
|
||||
/* Utilities */
|
||||
|
||||
.break-all {
|
||||
word-break: break-all;
|
||||
}
|
||||
1
vendor/laravel/framework/src/Illuminate/Mail/resources/views/text/button.blade.php
vendored
Normal file
1
vendor/laravel/framework/src/Illuminate/Mail/resources/views/text/button.blade.php
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{{ $slot }}: {{ $url }}
|
||||
1
vendor/laravel/framework/src/Illuminate/Mail/resources/views/text/footer.blade.php
vendored
Normal file
1
vendor/laravel/framework/src/Illuminate/Mail/resources/views/text/footer.blade.php
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{{ $slot }}
|
||||
1
vendor/laravel/framework/src/Illuminate/Mail/resources/views/text/header.blade.php
vendored
Normal file
1
vendor/laravel/framework/src/Illuminate/Mail/resources/views/text/header.blade.php
vendored
Normal file
@@ -0,0 +1 @@
|
||||
[{{ $slot }}]({{ $url }})
|
||||
9
vendor/laravel/framework/src/Illuminate/Mail/resources/views/text/layout.blade.php
vendored
Normal file
9
vendor/laravel/framework/src/Illuminate/Mail/resources/views/text/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/text/message.blade.php
vendored
Normal file
27
vendor/laravel/framework/src/Illuminate/Mail/resources/views/text/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') }}. @lang('All rights reserved.')
|
||||
@endcomponent
|
||||
@endslot
|
||||
@endcomponent
|
||||
1
vendor/laravel/framework/src/Illuminate/Mail/resources/views/text/panel.blade.php
vendored
Normal file
1
vendor/laravel/framework/src/Illuminate/Mail/resources/views/text/panel.blade.php
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{{ $slot }}
|
||||
1
vendor/laravel/framework/src/Illuminate/Mail/resources/views/text/subcopy.blade.php
vendored
Normal file
1
vendor/laravel/framework/src/Illuminate/Mail/resources/views/text/subcopy.blade.php
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{{ $slot }}
|
||||
1
vendor/laravel/framework/src/Illuminate/Mail/resources/views/text/table.blade.php
vendored
Normal file
1
vendor/laravel/framework/src/Illuminate/Mail/resources/views/text/table.blade.php
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{{ $slot }}
|
||||
Reference in New Issue
Block a user