Initial commit
This commit is contained in:
203
vendor/laravel/framework/src/Illuminate/Mail/Attachment.php
vendored
Normal file
203
vendor/laravel/framework/src/Illuminate/Mail/Attachment.php
vendored
Normal file
@@ -0,0 +1,203 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Mail;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Container\Container;
|
||||
use Illuminate\Contracts\Filesystem\Factory as FilesystemFactory;
|
||||
use Illuminate\Support\Traits\Macroable;
|
||||
use RuntimeException;
|
||||
|
||||
class Attachment
|
||||
{
|
||||
use Macroable;
|
||||
|
||||
/**
|
||||
* The attached file's filename.
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
public $as;
|
||||
|
||||
/**
|
||||
* The attached file's mime type.
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
public $mime;
|
||||
|
||||
/**
|
||||
* A callback that attaches the attachment to the mail message.
|
||||
*
|
||||
* @var \Closure
|
||||
*/
|
||||
protected $resolver;
|
||||
|
||||
/**
|
||||
* Create a mail attachment.
|
||||
*
|
||||
* @param \Closure $resolver
|
||||
* @return void
|
||||
*/
|
||||
private function __construct(Closure $resolver)
|
||||
{
|
||||
$this->resolver = $resolver;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a mail attachment from a path.
|
||||
*
|
||||
* @param string $path
|
||||
* @return static
|
||||
*/
|
||||
public static function fromPath($path)
|
||||
{
|
||||
return new static(fn ($attachment, $pathStrategy) => $pathStrategy($path, $attachment));
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a mail attachment from a URL.
|
||||
*
|
||||
* @param string $url
|
||||
* @return static
|
||||
*/
|
||||
public static function fromUrl($url)
|
||||
{
|
||||
return static::fromPath($url);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a mail attachment from in-memory data.
|
||||
*
|
||||
* @param \Closure $data
|
||||
* @param string|null $name
|
||||
* @return static
|
||||
*/
|
||||
public static function fromData(Closure $data, $name = null)
|
||||
{
|
||||
return (new static(
|
||||
fn ($attachment, $pathStrategy, $dataStrategy) => $dataStrategy($data, $attachment)
|
||||
))->as($name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a mail attachment from a file in the default storage disk.
|
||||
*
|
||||
* @param string $path
|
||||
* @return static
|
||||
*/
|
||||
public static function fromStorage($path)
|
||||
{
|
||||
return static::fromStorageDisk(null, $path);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a mail attachment from a file in the specified storage disk.
|
||||
*
|
||||
* @param string|null $disk
|
||||
* @param string $path
|
||||
* @return static
|
||||
*/
|
||||
public static function fromStorageDisk($disk, $path)
|
||||
{
|
||||
return new static(function ($attachment, $pathStrategy, $dataStrategy) use ($disk, $path) {
|
||||
$storage = Container::getInstance()->make(
|
||||
FilesystemFactory::class
|
||||
)->disk($disk);
|
||||
|
||||
$attachment
|
||||
->as($attachment->as ?? basename($path))
|
||||
->withMime($attachment->mime ?? $storage->mimeType($path));
|
||||
|
||||
return $dataStrategy(fn () => $storage->get($path), $attachment);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the attached file's filename.
|
||||
*
|
||||
* @param string|null $name
|
||||
* @return $this
|
||||
*/
|
||||
public function as($name)
|
||||
{
|
||||
$this->as = $name;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the attached file's mime type.
|
||||
*
|
||||
* @param string $mime
|
||||
* @return $this
|
||||
*/
|
||||
public function withMime($mime)
|
||||
{
|
||||
$this->mime = $mime;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Attach the attachment with the given strategies.
|
||||
*
|
||||
* @param \Closure $pathStrategy
|
||||
* @param \Closure $dataStrategy
|
||||
* @return mixed
|
||||
*/
|
||||
public function attachWith(Closure $pathStrategy, Closure $dataStrategy)
|
||||
{
|
||||
return ($this->resolver)($this, $pathStrategy, $dataStrategy);
|
||||
}
|
||||
|
||||
/**
|
||||
* Attach the attachment to a built-in mail type.
|
||||
*
|
||||
* @param \Illuminate\Mail\Mailable|\Illuminate\Mail\Message|\Illuminate\Notifications\Messages\MailMessage $mail
|
||||
* @param array $options
|
||||
* @return mixed
|
||||
*/
|
||||
public function attachTo($mail, $options = [])
|
||||
{
|
||||
return $this->attachWith(
|
||||
fn ($path) => $mail->attach($path, [
|
||||
'as' => $options['as'] ?? $this->as,
|
||||
'mime' => $options['mime'] ?? $this->mime,
|
||||
]),
|
||||
function ($data) use ($mail, $options) {
|
||||
$options = [
|
||||
'as' => $options['as'] ?? $this->as,
|
||||
'mime' => $options['mime'] ?? $this->mime,
|
||||
];
|
||||
|
||||
if ($options['as'] === null) {
|
||||
throw new RuntimeException('Attachment requires a filename to be specified.');
|
||||
}
|
||||
|
||||
return $mail->attachData($data(), $options['as'], ['mime' => $options['mime']]);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the given attachment is equivalent to this attachment.
|
||||
*
|
||||
* @param \Illuminate\Mail\Attachment $attachment
|
||||
* @param array $options
|
||||
* @return bool
|
||||
*/
|
||||
public function isEquivalent(Attachment $attachment, $options = [])
|
||||
{
|
||||
return with([
|
||||
'as' => $options['as'] ?? $attachment->as,
|
||||
'mime' => $options['mime'] ?? $attachment->mime,
|
||||
], fn ($options) => $this->attachWith(
|
||||
fn ($path) => [$path, ['as' => $this->as, 'mime' => $this->mime]],
|
||||
fn ($data) => [$data(), ['as' => $this->as, 'mime' => $this->mime]],
|
||||
) === $attachment->attachWith(
|
||||
fn ($path) => [$path, $options],
|
||||
fn ($data) => [$data(), $options],
|
||||
));
|
||||
}
|
||||
}
|
||||
35
vendor/laravel/framework/src/Illuminate/Mail/Events/MessageSending.php
vendored
Normal file
35
vendor/laravel/framework/src/Illuminate/Mail/Events/MessageSending.php
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Mail\Events;
|
||||
|
||||
use Symfony\Component\Mime\Email;
|
||||
|
||||
class MessageSending
|
||||
{
|
||||
/**
|
||||
* The Symfony Email instance.
|
||||
*
|
||||
* @var \Symfony\Component\Mime\Email
|
||||
*/
|
||||
public $message;
|
||||
|
||||
/**
|
||||
* The message data.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $data;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @param \Symfony\Component\Mime\Email $message
|
||||
* @param array $data
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Email $message, array $data = [])
|
||||
{
|
||||
$this->data = $data;
|
||||
$this->message = $message;
|
||||
}
|
||||
}
|
||||
88
vendor/laravel/framework/src/Illuminate/Mail/Events/MessageSent.php
vendored
Normal file
88
vendor/laravel/framework/src/Illuminate/Mail/Events/MessageSent.php
vendored
Normal file
@@ -0,0 +1,88 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Mail\Events;
|
||||
|
||||
use Exception;
|
||||
use Illuminate\Mail\SentMessage;
|
||||
use Illuminate\Support\Collection;
|
||||
|
||||
/**
|
||||
* @property \Symfony\Component\Mime\Email $message
|
||||
*/
|
||||
class MessageSent
|
||||
{
|
||||
/**
|
||||
* The message that was sent.
|
||||
*
|
||||
* @var \Illuminate\Mail\SentMessage
|
||||
*/
|
||||
public $sent;
|
||||
|
||||
/**
|
||||
* The message data.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $data;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @param \Illuminate\Mail\SentMessage $message
|
||||
* @param array $data
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(SentMessage $message, array $data = [])
|
||||
{
|
||||
$this->sent = $message;
|
||||
$this->data = $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the serializable representation of the object.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function __serialize()
|
||||
{
|
||||
$hasAttachments = (new Collection($this->message->getAttachments()))->isNotEmpty();
|
||||
|
||||
return [
|
||||
'sent' => $this->sent,
|
||||
'data' => $hasAttachments ? base64_encode(serialize($this->data)) : $this->data,
|
||||
'hasAttachments' => $hasAttachments,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Marshal the object from its serialized data.
|
||||
*
|
||||
* @param array $data
|
||||
* @return void
|
||||
*/
|
||||
public function __unserialize(array $data)
|
||||
{
|
||||
$this->sent = $data['sent'];
|
||||
|
||||
$this->data = (($data['hasAttachments'] ?? false) === true)
|
||||
? unserialize(base64_decode($data['data']))
|
||||
: $data['data'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Dynamically get the original message.
|
||||
*
|
||||
* @param string $key
|
||||
* @return mixed
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function __get($key)
|
||||
{
|
||||
if ($key === 'message') {
|
||||
return $this->sent->getOriginalMessage();
|
||||
}
|
||||
|
||||
throw new Exception('Unable to access undefined property on '.__CLASS__.': '.$key);
|
||||
}
|
||||
}
|
||||
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.
|
||||
624
vendor/laravel/framework/src/Illuminate/Mail/MailManager.php
vendored
Normal file
624
vendor/laravel/framework/src/Illuminate/Mail/MailManager.php
vendored
Normal file
@@ -0,0 +1,624 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Mail;
|
||||
|
||||
use Aws\Ses\SesClient;
|
||||
use Aws\SesV2\SesV2Client;
|
||||
use Closure;
|
||||
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\ResendTransport;
|
||||
use Illuminate\Mail\Transport\SesTransport;
|
||||
use Illuminate\Mail\Transport\SesV2Transport;
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Support\ConfigurationUrlParser;
|
||||
use Illuminate\Support\Str;
|
||||
use InvalidArgumentException;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Resend;
|
||||
use Symfony\Component\HttpClient\HttpClient;
|
||||
use Symfony\Component\Mailer\Bridge\Mailgun\Transport\MailgunTransportFactory;
|
||||
use Symfony\Component\Mailer\Bridge\Postmark\Transport\PostmarkTransportFactory;
|
||||
use Symfony\Component\Mailer\Transport\Dsn;
|
||||
use Symfony\Component\Mailer\Transport\FailoverTransport;
|
||||
use Symfony\Component\Mailer\Transport\RoundRobinTransport;
|
||||
use Symfony\Component\Mailer\Transport\SendmailTransport;
|
||||
use Symfony\Component\Mailer\Transport\Smtp\EsmtpTransport;
|
||||
use Symfony\Component\Mailer\Transport\Smtp\EsmtpTransportFactory;
|
||||
use Symfony\Component\Mailer\Transport\Smtp\Stream\SocketStream;
|
||||
|
||||
/**
|
||||
* @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\Contracts\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 = $this->build(['name' => $name, ...$config]);
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build a new mailer instance.
|
||||
*
|
||||
* @param array $config
|
||||
* @return \Illuminate\Mail\Mailer
|
||||
*/
|
||||
public function build($config)
|
||||
{
|
||||
$mailer = new Mailer(
|
||||
$config['name'] ?? 'ondemand',
|
||||
$this->app['view'],
|
||||
$this->createSymfonyTransport($config),
|
||||
$this->app['events']
|
||||
);
|
||||
|
||||
if ($this->app->bound('queue')) {
|
||||
$mailer->setQueue($this->app['queue']);
|
||||
}
|
||||
|
||||
return $mailer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new transport instance.
|
||||
*
|
||||
* @param array $config
|
||||
* @return \Symfony\Component\Mailer\Transport\TransportInterface
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function createSymfonyTransport(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(Str::camel($transport)).'Transport')) {
|
||||
throw new InvalidArgumentException("Unsupported mail transport [{$transport}].");
|
||||
}
|
||||
|
||||
return $this->{$method}($config);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of the Symfony SMTP Transport driver.
|
||||
*
|
||||
* @param array $config
|
||||
* @return \Symfony\Component\Mailer\Transport\Smtp\EsmtpTransport
|
||||
*/
|
||||
protected function createSmtpTransport(array $config)
|
||||
{
|
||||
$factory = new EsmtpTransportFactory;
|
||||
|
||||
$scheme = $config['scheme'] ?? null;
|
||||
|
||||
if (! $scheme) {
|
||||
$scheme = ($config['port'] == 465) ? 'smtps' : 'smtp';
|
||||
}
|
||||
|
||||
$transport = $factory->create(new Dsn(
|
||||
$scheme,
|
||||
$config['host'],
|
||||
$config['username'] ?? null,
|
||||
$config['password'] ?? null,
|
||||
$config['port'] ?? null,
|
||||
$config
|
||||
));
|
||||
|
||||
return $this->configureSmtpTransport($transport, $config);
|
||||
}
|
||||
|
||||
/**
|
||||
* Configure the additional SMTP driver options.
|
||||
*
|
||||
* @param \Symfony\Component\Mailer\Transport\Smtp\EsmtpTransport $transport
|
||||
* @param array $config
|
||||
* @return \Symfony\Component\Mailer\Transport\Smtp\EsmtpTransport
|
||||
*/
|
||||
protected function configureSmtpTransport(EsmtpTransport $transport, array $config)
|
||||
{
|
||||
$stream = $transport->getStream();
|
||||
|
||||
if ($stream instanceof SocketStream) {
|
||||
if (isset($config['source_ip'])) {
|
||||
$stream->setSourceIp($config['source_ip']);
|
||||
}
|
||||
|
||||
if (isset($config['timeout'])) {
|
||||
$stream->setTimeout($config['timeout']);
|
||||
}
|
||||
}
|
||||
|
||||
return $transport;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of the Symfony Sendmail Transport driver.
|
||||
*
|
||||
* @param array $config
|
||||
* @return \Symfony\Component\Mailer\Transport\SendmailTransport
|
||||
*/
|
||||
protected function createSendmailTransport(array $config)
|
||||
{
|
||||
return new SendmailTransport(
|
||||
$config['path'] ?? $this->app['config']->get('mail.sendmail')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of the Symfony Amazon SES Transport driver.
|
||||
*
|
||||
* @param array $config
|
||||
* @return \Illuminate\Mail\Transport\SesTransport
|
||||
*/
|
||||
protected function createSesTransport(array $config)
|
||||
{
|
||||
$config = array_merge(
|
||||
$this->app['config']->get('services.ses', []),
|
||||
['version' => 'latest', 'service' => 'email'],
|
||||
$config
|
||||
);
|
||||
|
||||
$config = Arr::except($config, ['transport']);
|
||||
|
||||
return new SesTransport(
|
||||
new SesClient($this->addSesCredentials($config)),
|
||||
$config['options'] ?? []
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of the Symfony Amazon SES V2 Transport driver.
|
||||
*
|
||||
* @param array $config
|
||||
* @return \Illuminate\Mail\Transport\SesV2Transport
|
||||
*/
|
||||
protected function createSesV2Transport(array $config)
|
||||
{
|
||||
$config = array_merge(
|
||||
$this->app['config']->get('services.ses', []),
|
||||
['version' => 'latest'],
|
||||
$config
|
||||
);
|
||||
|
||||
$config = Arr::except($config, ['transport']);
|
||||
|
||||
return new SesV2Transport(
|
||||
new SesV2Client($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']);
|
||||
|
||||
if (! empty($config['token'])) {
|
||||
$config['credentials']['token'] = $config['token'];
|
||||
}
|
||||
}
|
||||
|
||||
return Arr::except($config, ['token']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of the Resend Transport driver.
|
||||
*
|
||||
* @param array $config
|
||||
* @return \Illuminate\Mail\Transport\ResendTransprot
|
||||
*/
|
||||
protected function createResendTransport(array $config)
|
||||
{
|
||||
return new ResendTransport(
|
||||
Resend::client($config['key'] ?? $this->app['config']->get('services.resend.key')),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of the Symfony Mail Transport driver.
|
||||
*
|
||||
* @return \Symfony\Component\Mailer\Transport\SendmailTransport
|
||||
*/
|
||||
protected function createMailTransport()
|
||||
{
|
||||
return new SendmailTransport;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of the Symfony Mailgun Transport driver.
|
||||
*
|
||||
* @param array $config
|
||||
* @return \Symfony\Component\Mailer\Transport\TransportInterface
|
||||
*/
|
||||
protected function createMailgunTransport(array $config)
|
||||
{
|
||||
$factory = new MailgunTransportFactory(null, $this->getHttpClient($config));
|
||||
|
||||
if (! isset($config['secret'])) {
|
||||
$config = $this->app['config']->get('services.mailgun', []);
|
||||
}
|
||||
|
||||
return $factory->create(new Dsn(
|
||||
'mailgun+'.($config['scheme'] ?? 'https'),
|
||||
$config['endpoint'] ?? 'default',
|
||||
$config['secret'],
|
||||
$config['domain']
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of the Symfony Postmark Transport driver.
|
||||
*
|
||||
* @param array $config
|
||||
* @return \Symfony\Component\Mailer\Bridge\Postmark\Transport\PostmarkApiTransport
|
||||
*/
|
||||
protected function createPostmarkTransport(array $config)
|
||||
{
|
||||
$factory = new PostmarkTransportFactory(null, $this->getHttpClient($config));
|
||||
|
||||
$options = isset($config['message_stream_id'])
|
||||
? ['message_stream' => $config['message_stream_id']]
|
||||
: [];
|
||||
|
||||
return $factory->create(new Dsn(
|
||||
'postmark+api',
|
||||
'default',
|
||||
$config['token'] ?? $this->app['config']->get('services.postmark.token'),
|
||||
null,
|
||||
null,
|
||||
$options
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of the Symfony Failover Transport driver.
|
||||
*
|
||||
* @param array $config
|
||||
* @return \Symfony\Component\Mailer\Transport\FailoverTransport
|
||||
*/
|
||||
protected function createFailoverTransport(array $config)
|
||||
{
|
||||
$transports = [];
|
||||
|
||||
foreach ($config['mailers'] as $name) {
|
||||
$config = $this->getConfig($name);
|
||||
|
||||
if (is_null($config)) {
|
||||
throw new InvalidArgumentException("Mailer [{$name}] is not defined.");
|
||||
}
|
||||
|
||||
// Now, we will check if the "driver" key exists and if it does we will set
|
||||
// the transport configuration parameter in order to offer compatibility
|
||||
// with any Laravel <= 6.x application style mail configuration files.
|
||||
$transports[] = $this->app['config']['mail.driver']
|
||||
? $this->createSymfonyTransport(array_merge($config, ['transport' => $name]))
|
||||
: $this->createSymfonyTransport($config);
|
||||
}
|
||||
|
||||
return new FailoverTransport($transports);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of the Symfony Roundrobin Transport driver.
|
||||
*
|
||||
* @param array $config
|
||||
* @return \Symfony\Component\Mailer\Transport\RoundRobinTransport
|
||||
*/
|
||||
protected function createRoundrobinTransport(array $config)
|
||||
{
|
||||
$transports = [];
|
||||
|
||||
foreach ($config['mailers'] as $name) {
|
||||
$config = $this->getConfig($name);
|
||||
|
||||
if (is_null($config)) {
|
||||
throw new InvalidArgumentException("Mailer [{$name}] is not defined.");
|
||||
}
|
||||
|
||||
// Now, we will check if the "driver" key exists and if it does we will set
|
||||
// the transport configuration parameter in order to offer compatibility
|
||||
// with any Laravel <= 6.x application style mail configuration files.
|
||||
$transports[] = $this->app['config']['mail.driver']
|
||||
? $this->createSymfonyTransport(array_merge($config, ['transport' => $name]))
|
||||
: $this->createSymfonyTransport($config);
|
||||
}
|
||||
|
||||
return new RoundRobinTransport($transports);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of the Log 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 Transport Driver.
|
||||
*
|
||||
* @return \Illuminate\Mail\Transport\ArrayTransport
|
||||
*/
|
||||
protected function createArrayTransport()
|
||||
{
|
||||
return new ArrayTransport;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a configured Symfony HTTP client instance.
|
||||
*
|
||||
* @return \Symfony\Contracts\HttpClient\HttpClientInterface|null
|
||||
*/
|
||||
protected function getHttpClient(array $config)
|
||||
{
|
||||
if ($options = ($config['client'] ?? false)) {
|
||||
$maxHostConnections = Arr::pull($options, 'max_host_connections', 6);
|
||||
$maxPendingPushes = Arr::pull($options, 'max_pending_pushes', 50);
|
||||
|
||||
return HttpClient::create($options, $maxHostConnections, $maxPendingPushes);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
$config = $this->app['config']['mail.driver']
|
||||
? $this->app['config']['mail']
|
||||
: $this->app['config']["mail.mailers.{$name}"];
|
||||
|
||||
if (isset($config['url'])) {
|
||||
$config = array_merge($config, (new ConfigurationUrlParser)->parseConfiguration($config));
|
||||
|
||||
$config['transport'] = Arr::pull($config, 'driver');
|
||||
}
|
||||
|
||||
return $config;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Disconnect the given mailer and remove from local cache.
|
||||
*
|
||||
* @param string|null $name
|
||||
* @return void
|
||||
*/
|
||||
public function purge($name = null)
|
||||
{
|
||||
$name = $name ?: $this->getDefaultDriver();
|
||||
|
||||
unset($this->mailers[$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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the application instance used by the manager.
|
||||
*
|
||||
* @return \Illuminate\Contracts\Foundation\Application
|
||||
*/
|
||||
public function getApplication()
|
||||
{
|
||||
return $this->app;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the application instance used by the manager.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Foundation\Application $app
|
||||
* @return $this
|
||||
*/
|
||||
public function setApplication($app)
|
||||
{
|
||||
$this->app = $app;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Forget all of the resolved mailer instances.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function forgetMailers()
|
||||
{
|
||||
$this->mailers = [];
|
||||
|
||||
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,
|
||||
];
|
||||
}
|
||||
}
|
||||
1833
vendor/laravel/framework/src/Illuminate/Mail/Mailable.php
vendored
Normal file
1833
vendor/laravel/framework/src/Illuminate/Mail/Mailable.php
vendored
Normal file
File diff suppressed because it is too large
Load Diff
33
vendor/laravel/framework/src/Illuminate/Mail/Mailables/Address.php
vendored
Normal file
33
vendor/laravel/framework/src/Illuminate/Mail/Mailables/Address.php
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Mail\Mailables;
|
||||
|
||||
class Address
|
||||
{
|
||||
/**
|
||||
* The recipient's email address.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $address;
|
||||
|
||||
/**
|
||||
* The recipient's name.
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
public $name;
|
||||
|
||||
/**
|
||||
* Create a new address instance.
|
||||
*
|
||||
* @param string $address
|
||||
* @param string|null $name
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(string $address, ?string $name = null)
|
||||
{
|
||||
$this->address = $address;
|
||||
$this->name = $name;
|
||||
}
|
||||
}
|
||||
10
vendor/laravel/framework/src/Illuminate/Mail/Mailables/Attachment.php
vendored
Normal file
10
vendor/laravel/framework/src/Illuminate/Mail/Mailables/Attachment.php
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Mail\Mailables;
|
||||
|
||||
use Illuminate\Mail\Attachment as BaseAttachment;
|
||||
|
||||
class Attachment extends BaseAttachment
|
||||
{
|
||||
// Here for namespace consistency...
|
||||
}
|
||||
157
vendor/laravel/framework/src/Illuminate/Mail/Mailables/Content.php
vendored
Normal file
157
vendor/laravel/framework/src/Illuminate/Mail/Mailables/Content.php
vendored
Normal file
@@ -0,0 +1,157 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Mail\Mailables;
|
||||
|
||||
use Illuminate\Support\Traits\Conditionable;
|
||||
|
||||
class Content
|
||||
{
|
||||
use Conditionable;
|
||||
|
||||
/**
|
||||
* The Blade view that should be rendered for the mailable.
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
public $view;
|
||||
|
||||
/**
|
||||
* The Blade view that should be rendered for the mailable.
|
||||
*
|
||||
* Alternative syntax for "view".
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
public $html;
|
||||
|
||||
/**
|
||||
* The Blade view that represents the text version of the message.
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
public $text;
|
||||
|
||||
/**
|
||||
* The Blade view that represents the Markdown version of the message.
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
public $markdown;
|
||||
|
||||
/**
|
||||
* The pre-rendered HTML of the message.
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
public $htmlString;
|
||||
|
||||
/**
|
||||
* The message's view data.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $with;
|
||||
|
||||
/**
|
||||
* Create a new content definition.
|
||||
*
|
||||
* @param string|null $view
|
||||
* @param string|null $html
|
||||
* @param string|null $text
|
||||
* @param string|null $markdown
|
||||
* @param array $with
|
||||
* @param string|null $htmlString
|
||||
*
|
||||
* @named-arguments-supported
|
||||
*/
|
||||
public function __construct(?string $view = null, ?string $html = null, ?string $text = null, $markdown = null, array $with = [], ?string $htmlString = null)
|
||||
{
|
||||
$this->view = $view;
|
||||
$this->html = $html;
|
||||
$this->text = $text;
|
||||
$this->markdown = $markdown;
|
||||
$this->with = $with;
|
||||
$this->htmlString = $htmlString;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the view for the message.
|
||||
*
|
||||
* @param string $view
|
||||
* @return $this
|
||||
*/
|
||||
public function view(string $view)
|
||||
{
|
||||
$this->view = $view;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the view for the message.
|
||||
*
|
||||
* @param string $view
|
||||
* @return $this
|
||||
*/
|
||||
public function html(string $view)
|
||||
{
|
||||
return $this->view($view);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the plain text view for the message.
|
||||
*
|
||||
* @param string $view
|
||||
* @return $this
|
||||
*/
|
||||
public function text(string $view)
|
||||
{
|
||||
$this->text = $view;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the Markdown view for the message.
|
||||
*
|
||||
* @param string $view
|
||||
* @return $this
|
||||
*/
|
||||
public function markdown(string $view)
|
||||
{
|
||||
$this->markdown = $view;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the pre-rendered HTML for the message.
|
||||
*
|
||||
* @param string $html
|
||||
* @return $this
|
||||
*/
|
||||
public function htmlString(string $html)
|
||||
{
|
||||
$this->htmlString = $html;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a piece of view data to the message.
|
||||
*
|
||||
* @param array|string $key
|
||||
* @param mixed|null $value
|
||||
* @return $this
|
||||
*/
|
||||
public function with($key, $value = null)
|
||||
{
|
||||
if (is_array($key)) {
|
||||
$this->with = array_merge($this->with, $key);
|
||||
} else {
|
||||
$this->with[$key] = $value;
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
370
vendor/laravel/framework/src/Illuminate/Mail/Mailables/Envelope.php
vendored
Normal file
370
vendor/laravel/framework/src/Illuminate/Mail/Mailables/Envelope.php
vendored
Normal file
@@ -0,0 +1,370 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Mail\Mailables;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Traits\Conditionable;
|
||||
|
||||
class Envelope
|
||||
{
|
||||
use Conditionable;
|
||||
|
||||
/**
|
||||
* The address sending the message.
|
||||
*
|
||||
* @var \Illuminate\Mail\Mailables\Address|string|null
|
||||
*/
|
||||
public $from;
|
||||
|
||||
/**
|
||||
* The recipients of the message.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $to;
|
||||
|
||||
/**
|
||||
* The recipients receiving a copy of the message.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $cc;
|
||||
|
||||
/**
|
||||
* The recipients receiving a blind copy of the message.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $bcc;
|
||||
|
||||
/**
|
||||
* The recipients that should be replied to.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $replyTo;
|
||||
|
||||
/**
|
||||
* The subject of the message.
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
public $subject;
|
||||
|
||||
/**
|
||||
* The message's tags.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $tags = [];
|
||||
|
||||
/**
|
||||
* The message's meta data.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $metadata = [];
|
||||
|
||||
/**
|
||||
* The message's Symfony Message customization callbacks.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $using = [];
|
||||
|
||||
/**
|
||||
* Create a new message envelope instance.
|
||||
*
|
||||
* @param \Illuminate\Mail\Mailables\Address|string|null $from
|
||||
* @param array<int, \Illuminate\Mail\Mailables\Address|string> $to
|
||||
* @param array<int, \Illuminate\Mail\Mailables\Address|string> $cc
|
||||
* @param array<int, \Illuminate\Mail\Mailables\Address|string> $bcc
|
||||
* @param array<int, \Illuminate\Mail\Mailables\Address|string> $replyTo
|
||||
* @param string|null $subject
|
||||
* @param array $tags
|
||||
* @param array $metadata
|
||||
* @param \Closure|array $using
|
||||
* @return void
|
||||
*
|
||||
* @named-arguments-supported
|
||||
*/
|
||||
public function __construct(Address|string|null $from = null, $to = [], $cc = [], $bcc = [], $replyTo = [], ?string $subject = null, array $tags = [], array $metadata = [], Closure|array $using = [])
|
||||
{
|
||||
$this->from = is_string($from) ? new Address($from) : $from;
|
||||
$this->to = $this->normalizeAddresses($to);
|
||||
$this->cc = $this->normalizeAddresses($cc);
|
||||
$this->bcc = $this->normalizeAddresses($bcc);
|
||||
$this->replyTo = $this->normalizeAddresses($replyTo);
|
||||
$this->subject = $subject;
|
||||
$this->tags = $tags;
|
||||
$this->metadata = $metadata;
|
||||
$this->using = Arr::wrap($using);
|
||||
}
|
||||
|
||||
/**
|
||||
* Normalize the given array of addresses.
|
||||
*
|
||||
* @param array<int, \Illuminate\Mail\Mailables\Address|string> $addresses
|
||||
* @return array<int, \Illuminate\Mail\Mailables\Address>
|
||||
*/
|
||||
protected function normalizeAddresses($addresses)
|
||||
{
|
||||
return (new Collection($addresses))
|
||||
->map(fn ($address) => is_string($address) ? new Address($address) : $address)
|
||||
->all();
|
||||
}
|
||||
|
||||
/**
|
||||
* Specify who the message will be "from".
|
||||
*
|
||||
* @param \Illuminate\Mail\Mailables\Address|string $address
|
||||
* @param string|null $name
|
||||
* @return $this
|
||||
*/
|
||||
public function from(Address|string $address, $name = null)
|
||||
{
|
||||
$this->from = is_string($address) ? new Address($address, $name) : $address;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a "to" recipient to the message envelope.
|
||||
*
|
||||
* @param \Illuminate\Mail\Mailables\Address|array<int, \Illuminate\Mail\Mailables\Address|string>|string $address
|
||||
* @param string|null $name
|
||||
* @return $this
|
||||
*/
|
||||
public function to(Address|array|string $address, $name = null)
|
||||
{
|
||||
$this->to = array_merge($this->to, $this->normalizeAddresses(
|
||||
is_string($name) ? [new Address($address, $name)] : Arr::wrap($address),
|
||||
));
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a "cc" recipient to the message envelope.
|
||||
*
|
||||
* @param \Illuminate\Mail\Mailables\Address|array<int, \Illuminate\Mail\Mailables\Address|string>|string $address
|
||||
* @param string|null $name
|
||||
* @return $this
|
||||
*/
|
||||
public function cc(Address|array|string $address, $name = null)
|
||||
{
|
||||
$this->cc = array_merge($this->cc, $this->normalizeAddresses(
|
||||
is_string($name) ? [new Address($address, $name)] : Arr::wrap($address),
|
||||
));
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a "bcc" recipient to the message envelope.
|
||||
*
|
||||
* @param \Illuminate\Mail\Mailables\Address|array<int, \Illuminate\Mail\Mailables\Address|string>|string $address
|
||||
* @param string|null $name
|
||||
* @return $this
|
||||
*/
|
||||
public function bcc(Address|array|string $address, $name = null)
|
||||
{
|
||||
$this->bcc = array_merge($this->bcc, $this->normalizeAddresses(
|
||||
is_string($name) ? [new Address($address, $name)] : Arr::wrap($address),
|
||||
));
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a "reply to" recipient to the message envelope.
|
||||
*
|
||||
* @param \Illuminate\Mail\Mailables\Address|array<int, \Illuminate\Mail\Mailables\Address|string>|string $address
|
||||
* @param string|null $name
|
||||
* @return $this
|
||||
*/
|
||||
public function replyTo(Address|array|string $address, $name = null)
|
||||
{
|
||||
$this->replyTo = array_merge($this->replyTo, $this->normalizeAddresses(
|
||||
is_string($name) ? [new Address($address, $name)] : Arr::wrap($address),
|
||||
));
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the subject of the message.
|
||||
*
|
||||
* @param string $subject
|
||||
* @return $this
|
||||
*/
|
||||
public function subject(string $subject)
|
||||
{
|
||||
$this->subject = $subject;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add "tags" to the message.
|
||||
*
|
||||
* @param array $tags
|
||||
* @return $this
|
||||
*/
|
||||
public function tags(array $tags)
|
||||
{
|
||||
$this->tags = array_merge($this->tags, $tags);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a "tag" to the message.
|
||||
*
|
||||
* @param string $tag
|
||||
* @return $this
|
||||
*/
|
||||
public function tag(string $tag)
|
||||
{
|
||||
$this->tags[] = $tag;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add metadata to the message.
|
||||
*
|
||||
* @param string $key
|
||||
* @param string|int $value
|
||||
* @return $this
|
||||
*/
|
||||
public function metadata(string $key, string|int $value)
|
||||
{
|
||||
$this->metadata[$key] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a Symfony Message customization callback to the message.
|
||||
*
|
||||
* @param \Closure $callback
|
||||
* @return $this
|
||||
*/
|
||||
public function using(Closure $callback)
|
||||
{
|
||||
$this->using[] = $callback;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the message is from the given address.
|
||||
*
|
||||
* @param string $address
|
||||
* @param string|null $name
|
||||
* @return bool
|
||||
*/
|
||||
public function isFrom(string $address, ?string $name = null)
|
||||
{
|
||||
if (is_null($name)) {
|
||||
return $this->from->address === $address;
|
||||
}
|
||||
|
||||
return $this->from->address === $address &&
|
||||
$this->from->name === $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the message has the given address as a recipient.
|
||||
*
|
||||
* @param string $address
|
||||
* @param string|null $name
|
||||
* @return bool
|
||||
*/
|
||||
public function hasTo(string $address, ?string $name = null)
|
||||
{
|
||||
return $this->hasRecipient($this->to, $address, $name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the message has the given address as a "cc" recipient.
|
||||
*
|
||||
* @param string $address
|
||||
* @param string|null $name
|
||||
* @return bool
|
||||
*/
|
||||
public function hasCc(string $address, ?string $name = null)
|
||||
{
|
||||
return $this->hasRecipient($this->cc, $address, $name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the message has the given address as a "bcc" recipient.
|
||||
*
|
||||
* @param string $address
|
||||
* @param string|null $name
|
||||
* @return bool
|
||||
*/
|
||||
public function hasBcc(string $address, ?string $name = null)
|
||||
{
|
||||
return $this->hasRecipient($this->bcc, $address, $name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the message has the given address as a "reply to" recipient.
|
||||
*
|
||||
* @param string $address
|
||||
* @param string|null $name
|
||||
* @return bool
|
||||
*/
|
||||
public function hasReplyTo(string $address, ?string $name = null)
|
||||
{
|
||||
return $this->hasRecipient($this->replyTo, $address, $name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the message has the given recipient.
|
||||
*
|
||||
* @param array $recipients
|
||||
* @param string $address
|
||||
* @param string|null $name
|
||||
* @return bool
|
||||
*/
|
||||
protected function hasRecipient(array $recipients, string $address, ?string $name = null)
|
||||
{
|
||||
return (new Collection($recipients))->contains(function ($recipient) use ($address, $name) {
|
||||
if (is_null($name)) {
|
||||
return $recipient->address === $address;
|
||||
}
|
||||
|
||||
return $recipient->address === $address &&
|
||||
$recipient->name === $name;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the message has the given subject.
|
||||
*
|
||||
* @param string $subject
|
||||
* @return bool
|
||||
*/
|
||||
public function hasSubject(string $subject)
|
||||
{
|
||||
return $this->subject === $subject;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the message has the given metadata.
|
||||
*
|
||||
* @param string $key
|
||||
* @param string $value
|
||||
* @return bool
|
||||
*/
|
||||
public function hasMetadata(string $key, string $value)
|
||||
{
|
||||
return isset($this->metadata[$key]) && (string) $this->metadata[$key] === $value;
|
||||
}
|
||||
}
|
||||
101
vendor/laravel/framework/src/Illuminate/Mail/Mailables/Headers.php
vendored
Normal file
101
vendor/laravel/framework/src/Illuminate/Mail/Mailables/Headers.php
vendored
Normal file
@@ -0,0 +1,101 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Mail\Mailables;
|
||||
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Support\Traits\Conditionable;
|
||||
|
||||
class Headers
|
||||
{
|
||||
use Conditionable;
|
||||
|
||||
/**
|
||||
* The message's message ID.
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
public $messageId;
|
||||
|
||||
/**
|
||||
* The message IDs that are referenced by the message.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $references;
|
||||
|
||||
/**
|
||||
* The message's text headers.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $text;
|
||||
|
||||
/**
|
||||
* Create a new instance of headers for a message.
|
||||
*
|
||||
* @param string|null $messageId
|
||||
* @param array $references
|
||||
* @param array $text
|
||||
* @return void
|
||||
*
|
||||
* @named-arguments-supported
|
||||
*/
|
||||
public function __construct(?string $messageId = null, array $references = [], array $text = [])
|
||||
{
|
||||
$this->messageId = $messageId;
|
||||
$this->references = $references;
|
||||
$this->text = $text;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the message ID.
|
||||
*
|
||||
* @param string $messageId
|
||||
* @return $this
|
||||
*/
|
||||
public function messageId(string $messageId)
|
||||
{
|
||||
$this->messageId = $messageId;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the message IDs referenced by this message.
|
||||
*
|
||||
* @param array $references
|
||||
* @return $this
|
||||
*/
|
||||
public function references(array $references)
|
||||
{
|
||||
$this->references = array_merge($this->references, $references);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the headers for this message.
|
||||
*
|
||||
* @param array $text
|
||||
* @return $this
|
||||
*/
|
||||
public function text(array $text)
|
||||
{
|
||||
$this->text = array_merge($this->text, $text);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the references header as a string.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function referencesString(): string
|
||||
{
|
||||
return (new Collection($this->references))
|
||||
->map(fn ($messageId) => Str::finish(Str::start($messageId, '<'), '>'))
|
||||
->implode(' ');
|
||||
}
|
||||
}
|
||||
666
vendor/laravel/framework/src/Illuminate/Mail/Mailer.php
vendored
Executable file
666
vendor/laravel/framework/src/Illuminate/Mail/Mailer.php
vendored
Executable file
@@ -0,0 +1,666 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Mail;
|
||||
|
||||
use Closure;
|
||||
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\Mail\Mailables\Address;
|
||||
use Illuminate\Support\HtmlString;
|
||||
use Illuminate\Support\Traits\Macroable;
|
||||
use InvalidArgumentException;
|
||||
use Symfony\Component\Mailer\Envelope;
|
||||
use Symfony\Component\Mailer\Transport\TransportInterface;
|
||||
use Symfony\Component\Mime\Email;
|
||||
|
||||
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 Symfony Transport instance.
|
||||
*
|
||||
* @var \Symfony\Component\Mailer\Transport\TransportInterface
|
||||
*/
|
||||
protected $transport;
|
||||
|
||||
/**
|
||||
* 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;
|
||||
|
||||
/**
|
||||
* Create a new Mailer instance.
|
||||
*
|
||||
* @param string $name
|
||||
* @param \Illuminate\Contracts\View\Factory $views
|
||||
* @param \Symfony\Component\Mailer\Transport\TransportInterface $transport
|
||||
* @param \Illuminate\Contracts\Events\Dispatcher|null $events
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(string $name, Factory $views, TransportInterface $transport, ?Dispatcher $events = null)
|
||||
{
|
||||
$this->name = $name;
|
||||
$this->views = $views;
|
||||
$this->events = $events;
|
||||
$this->transport = $transport;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
* @param string|null $name
|
||||
* @return \Illuminate\Mail\PendingMail
|
||||
*/
|
||||
public function to($users, $name = null)
|
||||
{
|
||||
if (! is_null($name) && is_string($users)) {
|
||||
$users = new Address($users, $name);
|
||||
}
|
||||
|
||||
return (new PendingMail($this))->to($users);
|
||||
}
|
||||
|
||||
/**
|
||||
* Begin the process of mailing a mailable class instance.
|
||||
*
|
||||
* @param mixed $users
|
||||
* @param string|null $name
|
||||
* @return \Illuminate\Mail\PendingMail
|
||||
*/
|
||||
public function cc($users, $name = null)
|
||||
{
|
||||
if (! is_null($name) && is_string($users)) {
|
||||
$users = new Address($users, $name);
|
||||
}
|
||||
|
||||
return (new PendingMail($this))->cc($users);
|
||||
}
|
||||
|
||||
/**
|
||||
* Begin the process of mailing a mailable class instance.
|
||||
*
|
||||
* @param mixed $users
|
||||
* @param string|null $name
|
||||
* @return \Illuminate\Mail\PendingMail
|
||||
*/
|
||||
public function bcc($users, $name = null)
|
||||
{
|
||||
if (! is_null($name) && is_string($users)) {
|
||||
$users = new Address($users, $name);
|
||||
}
|
||||
|
||||
return (new PendingMail($this))->bcc($users);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a new message with only an HTML part.
|
||||
*
|
||||
* @param string $html
|
||||
* @param mixed $callback
|
||||
* @return \Illuminate\Mail\SentMessage|null
|
||||
*/
|
||||
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 \Illuminate\Mail\SentMessage|null
|
||||
*/
|
||||
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 \Illuminate\Mail\SentMessage|null
|
||||
*/
|
||||
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->replaceEmbeddedAttachments(
|
||||
$this->renderView($view ?: $plain, $data),
|
||||
$data['message']->getSymfonyMessage()->getAttachments()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace the embedded image attachments with raw, inline image data for browser rendering.
|
||||
*
|
||||
* @param string $renderedView
|
||||
* @param array $attachments
|
||||
* @return string
|
||||
*/
|
||||
protected function replaceEmbeddedAttachments(string $renderedView, array $attachments)
|
||||
{
|
||||
if (preg_match_all('/<img.+?src=[\'"]cid:([^\'"]+)[\'"].*?>/i', $renderedView, $matches)) {
|
||||
foreach (array_unique($matches[1]) as $image) {
|
||||
foreach ($attachments as $attachment) {
|
||||
if ($attachment->getFilename() === $image) {
|
||||
$renderedView = str_replace(
|
||||
'cid:'.$image,
|
||||
'data:'.$attachment->getContentType().';base64,'.$attachment->bodyToString(),
|
||||
$renderedView
|
||||
);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $renderedView;
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a new message using a view.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Mail\Mailable|string|array $view
|
||||
* @param array $data
|
||||
* @param \Closure|string|null $callback
|
||||
* @return \Illuminate\Mail\SentMessage|null
|
||||
*/
|
||||
public function send($view, array $data = [], $callback = null)
|
||||
{
|
||||
if ($view instanceof MailableContract) {
|
||||
return $this->sendMailable($view);
|
||||
}
|
||||
|
||||
$data['mailer'] = $this->name;
|
||||
|
||||
// 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.
|
||||
[$view, $plain, $raw] = $this->parseView($view);
|
||||
|
||||
$data['message'] = $message = $this->createMessage();
|
||||
|
||||
$this->addContent($message, $view, $plain, $raw, $data);
|
||||
|
||||
if (! is_null($callback)) {
|
||||
$callback($message);
|
||||
}
|
||||
|
||||
// If a global "to" address has been set, we will set that address on the mail
|
||||
// message. This is primarily useful during local development in which each
|
||||
// message should be delivered into a single mail address for inspection.
|
||||
if (isset($this->to['address'])) {
|
||||
$this->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.
|
||||
$symfonyMessage = $message->getSymfonyMessage();
|
||||
|
||||
if ($this->shouldSendMessage($symfonyMessage, $data)) {
|
||||
$symfonySentMessage = $this->sendSymfonyMessage($symfonyMessage);
|
||||
|
||||
if ($symfonySentMessage) {
|
||||
$sentMessage = new SentMessage($symfonySentMessage);
|
||||
|
||||
$this->dispatchSentEvent($sentMessage, $data);
|
||||
|
||||
return $sentMessage;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Send the given mailable.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Mail\Mailable $mailable
|
||||
* @return \Illuminate\Mail\SentMessage|null
|
||||
*/
|
||||
protected function sendMailable(MailableContract $mailable)
|
||||
{
|
||||
return $mailable instanceof ShouldQueue
|
||||
? $mailable->mailer($this->name)->queue($this->queue)
|
||||
: $mailable->mailer($this->name)->send($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a new message synchronously using a view.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Mail\Mailable|string|array $mailable
|
||||
* @param array $data
|
||||
* @param \Closure|string|null $callback
|
||||
* @return \Illuminate\Mail\SentMessage|null
|
||||
*/
|
||||
public function sendNow($mailable, array $data = [], $callback = null)
|
||||
{
|
||||
return $mailable instanceof MailableContract
|
||||
? $mailable->mailer($this->name)->send($this)
|
||||
: $this->send($mailable, $data, $callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the given view name or array.
|
||||
*
|
||||
* @param \Closure|array|string $view
|
||||
* @return array
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
protected function parseView($view)
|
||||
{
|
||||
if (is_string($view) || $view instanceof Closure) {
|
||||
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|null $view
|
||||
* @param string|null $plain
|
||||
* @param string|null $raw
|
||||
* @param array $data
|
||||
* @return void
|
||||
*/
|
||||
protected function addContent($message, $view, $plain, $raw, $data)
|
||||
{
|
||||
if (isset($view)) {
|
||||
$message->html($this->renderView($view, $data) ?: ' ');
|
||||
}
|
||||
|
||||
if (isset($plain)) {
|
||||
$message->text($this->renderView($plain, $data) ?: ' ');
|
||||
}
|
||||
|
||||
if (isset($raw)) {
|
||||
$message->text($raw);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the given view.
|
||||
*
|
||||
* @param \Closure|string $view
|
||||
* @param array $data
|
||||
* @return string
|
||||
*/
|
||||
protected function renderView($view, $data)
|
||||
{
|
||||
$view = value($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->forgetTo();
|
||||
|
||||
$message->to($this->to['address'], $this->to['name'], true);
|
||||
|
||||
$message->forgetCc();
|
||||
$message->forgetBcc();
|
||||
}
|
||||
|
||||
/**
|
||||
* Queue a new mail message for sending.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Mail\Mailable|string|array $view
|
||||
* @param \BackedEnum|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 mail message for sending on the given queue.
|
||||
*
|
||||
* @param \BackedEnum|string|null $queue
|
||||
* @param \Illuminate\Contracts\Mail\Mailable $view
|
||||
* @return mixed
|
||||
*/
|
||||
public function onQueue($queue, $view)
|
||||
{
|
||||
return $this->queue($view, $queue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Queue a new 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 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 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(new Email());
|
||||
|
||||
// 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 Symfony Email instance.
|
||||
*
|
||||
* @param \Symfony\Component\Mime\Email $message
|
||||
* @return \Symfony\Component\Mailer\SentMessage|null
|
||||
*/
|
||||
protected function sendSymfonyMessage(Email $message)
|
||||
{
|
||||
try {
|
||||
return $this->transport->send($message, Envelope::create($message));
|
||||
} finally {
|
||||
//
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if the email can be sent.
|
||||
*
|
||||
* @param \Symfony\Component\Mime\Email $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\SentMessage $message
|
||||
* @param array $data
|
||||
* @return void
|
||||
*/
|
||||
protected function dispatchSentEvent($message, $data = [])
|
||||
{
|
||||
$this->events?->dispatch(
|
||||
new MessageSent($message, $data)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Symfony Transport instance.
|
||||
*
|
||||
* @return \Symfony\Component\Mailer\Transport\TransportInterface
|
||||
*/
|
||||
public function getSymfonyTransport()
|
||||
{
|
||||
return $this->transport;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the view factory instance.
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\Factory
|
||||
*/
|
||||
public function getViewFactory()
|
||||
{
|
||||
return $this->views;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the Symfony Transport instance.
|
||||
*
|
||||
* @param \Symfony\Component\Mailer\Transport\TransportInterface $transport
|
||||
* @return void
|
||||
*/
|
||||
public function setSymfonyTransport(TransportInterface $transport)
|
||||
{
|
||||
$this->transport = $transport;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the queue manager instance.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Queue\Factory $queue
|
||||
* @return $this
|
||||
*/
|
||||
public function setQueue(QueueContract $queue)
|
||||
{
|
||||
$this->queue = $queue;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
189
vendor/laravel/framework/src/Illuminate/Mail/Markdown.php
vendored
Normal file
189
vendor/laravel/framework/src/Illuminate/Mail/Markdown.php
vendored
Normal file
@@ -0,0 +1,189 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Mail;
|
||||
|
||||
use Illuminate\Contracts\View\Factory as ViewFactory;
|
||||
use Illuminate\Support\HtmlString;
|
||||
use Illuminate\Support\Str;
|
||||
use League\CommonMark\Environment\Environment;
|
||||
use League\CommonMark\Extension\CommonMark\CommonMarkCoreExtension;
|
||||
use League\CommonMark\Extension\Table\TableExtension;
|
||||
use League\CommonMark\MarkdownConverter;
|
||||
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();
|
||||
|
||||
if ($this->view->exists($customTheme = Str::start($this->theme, 'mail.'))) {
|
||||
$theme = $customTheme;
|
||||
} else {
|
||||
$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 = new Environment([
|
||||
'allow_unsafe_links' => false,
|
||||
]);
|
||||
|
||||
$environment->addExtension(new CommonMarkCoreExtension);
|
||||
$environment->addExtension(new TableExtension);
|
||||
|
||||
$converter = new MarkdownConverter($environment);
|
||||
|
||||
return new HtmlString($converter->convert($text)->getContent());
|
||||
}
|
||||
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the theme currently being used by the renderer.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getTheme()
|
||||
{
|
||||
return $this->theme;
|
||||
}
|
||||
}
|
||||
413
vendor/laravel/framework/src/Illuminate/Mail/Message.php
vendored
Executable file
413
vendor/laravel/framework/src/Illuminate/Mail/Message.php
vendored
Executable file
@@ -0,0 +1,413 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Mail;
|
||||
|
||||
use Illuminate\Contracts\Mail\Attachable;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Support\Traits\ForwardsCalls;
|
||||
use Symfony\Component\Mime\Address;
|
||||
use Symfony\Component\Mime\Email;
|
||||
use Symfony\Component\Mime\Part\DataPart;
|
||||
use Symfony\Component\Mime\Part\File;
|
||||
|
||||
/**
|
||||
* @mixin \Symfony\Component\Mime\Email
|
||||
*/
|
||||
class Message
|
||||
{
|
||||
use ForwardsCalls;
|
||||
|
||||
/**
|
||||
* The Symfony Email instance.
|
||||
*
|
||||
* @var \Symfony\Component\Mime\Email
|
||||
*/
|
||||
protected $message;
|
||||
|
||||
/**
|
||||
* CIDs of files embedded in the message.
|
||||
*
|
||||
* @deprecated Will be removed in a future Laravel version.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $embeddedFiles = [];
|
||||
|
||||
/**
|
||||
* Create a new message instance.
|
||||
*
|
||||
* @param \Symfony\Component\Mime\Email $message
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Email $message)
|
||||
{
|
||||
$this->message = $message;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a "from" address to the message.
|
||||
*
|
||||
* @param string|array $address
|
||||
* @param string|null $name
|
||||
* @return $this
|
||||
*/
|
||||
public function from($address, $name = null)
|
||||
{
|
||||
is_array($address)
|
||||
? $this->message->from(...$address)
|
||||
: $this->message->from(new Address($address, (string) $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)
|
||||
{
|
||||
is_array($address)
|
||||
? $this->message->sender(...$address)
|
||||
: $this->message->sender(new Address($address, (string) $name));
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the "return path" of the message.
|
||||
*
|
||||
* @param string $address
|
||||
* @return $this
|
||||
*/
|
||||
public function returnPath($address)
|
||||
{
|
||||
$this->message->returnPath($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) {
|
||||
is_array($address)
|
||||
? $this->message->to(...$address)
|
||||
: $this->message->to(new Address($address, (string) $name));
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
return $this->addAddresses($address, $name, 'To');
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove all "to" addresses from the message.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function forgetTo()
|
||||
{
|
||||
if ($header = $this->message->getHeaders()->get('To')) {
|
||||
$this->addAddressDebugHeader('X-To', $this->message->getTo());
|
||||
|
||||
$header->setAddresses([]);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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) {
|
||||
is_array($address)
|
||||
? $this->message->cc(...$address)
|
||||
: $this->message->cc(new Address($address, (string) $name));
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
return $this->addAddresses($address, $name, 'Cc');
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove all carbon copy addresses from the message.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function forgetCc()
|
||||
{
|
||||
if ($header = $this->message->getHeaders()->get('Cc')) {
|
||||
$this->addAddressDebugHeader('X-Cc', $this->message->getCC());
|
||||
|
||||
$header->setAddresses([]);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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) {
|
||||
is_array($address)
|
||||
? $this->message->bcc(...$address)
|
||||
: $this->message->bcc(new Address($address, (string) $name));
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
return $this->addAddresses($address, $name, 'Bcc');
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove all of the blind carbon copy addresses from the message.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function forgetBcc()
|
||||
{
|
||||
if ($header = $this->message->getHeaders()->get('Bcc')) {
|
||||
$this->addAddressDebugHeader('X-Bcc', $this->message->getBcc());
|
||||
|
||||
$header->setAddresses([]);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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)) {
|
||||
$type = lcfirst($type);
|
||||
|
||||
$addresses = (new Collection($address))->map(function ($address, $key) {
|
||||
if (is_string($key) && is_string($address)) {
|
||||
return new Address($key, $address);
|
||||
}
|
||||
|
||||
if (is_array($address)) {
|
||||
return new Address($address['email'] ?? $address['address'], $address['name'] ?? null);
|
||||
}
|
||||
|
||||
if (is_null($address)) {
|
||||
return new Address($key);
|
||||
}
|
||||
|
||||
return $address;
|
||||
})->all();
|
||||
|
||||
$this->message->{"{$type}"}(...$addresses);
|
||||
} else {
|
||||
$this->message->{"add{$type}"}(new Address($address, (string) $name));
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an address debug header for a list of recipients.
|
||||
*
|
||||
* @param string $header
|
||||
* @param \Symfony\Component\Mime\Address[] $addresses
|
||||
* @return $this
|
||||
*/
|
||||
protected function addAddressDebugHeader(string $header, array $addresses)
|
||||
{
|
||||
$this->message->getHeaders()->addTextHeader(
|
||||
$header,
|
||||
implode(', ', array_map(fn ($a) => $a->toString(), $addresses)),
|
||||
);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the subject of the message.
|
||||
*
|
||||
* @param string $subject
|
||||
* @return $this
|
||||
*/
|
||||
public function subject($subject)
|
||||
{
|
||||
$this->message->subject($subject);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the message priority level.
|
||||
*
|
||||
* @param int $level
|
||||
* @return $this
|
||||
*/
|
||||
public function priority($level)
|
||||
{
|
||||
$this->message->priority($level);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Attach a file to the message.
|
||||
*
|
||||
* @param string|\Illuminate\Contracts\Mail\Attachable|\Illuminate\Mail\Attachment $file
|
||||
* @param array $options
|
||||
* @return $this
|
||||
*/
|
||||
public function attach($file, array $options = [])
|
||||
{
|
||||
if ($file instanceof Attachable) {
|
||||
$file = $file->toMailAttachment();
|
||||
}
|
||||
|
||||
if ($file instanceof Attachment) {
|
||||
return $file->attachTo($this);
|
||||
}
|
||||
|
||||
$this->message->attachFromPath($file, $options['as'] ?? null, $options['mime'] ?? null);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Attach in-memory data as an attachment.
|
||||
*
|
||||
* @param string|resource $data
|
||||
* @param string $name
|
||||
* @param array $options
|
||||
* @return $this
|
||||
*/
|
||||
public function attachData($data, $name, array $options = [])
|
||||
{
|
||||
$this->message->attach($data, $name, $options['mime'] ?? null);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Embed a file in the message and get the CID.
|
||||
*
|
||||
* @param string|\Illuminate\Contracts\Mail\Attachable|\Illuminate\Mail\Attachment $file
|
||||
* @return string
|
||||
*/
|
||||
public function embed($file)
|
||||
{
|
||||
if ($file instanceof Attachable) {
|
||||
$file = $file->toMailAttachment();
|
||||
}
|
||||
|
||||
if ($file instanceof Attachment) {
|
||||
return $file->attachWith(
|
||||
function ($path) use ($file) {
|
||||
$cid = $file->as ?? Str::random();
|
||||
|
||||
$this->message->addPart(
|
||||
(new DataPart(new File($path), $cid, $file->mime))->asInline()
|
||||
);
|
||||
|
||||
return "cid:{$cid}";
|
||||
},
|
||||
function ($data) use ($file) {
|
||||
$this->message->addPart(
|
||||
(new DataPart($data(), $file->as, $file->mime))->asInline()
|
||||
);
|
||||
|
||||
return "cid:{$file->as}";
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
$cid = Str::random(10);
|
||||
|
||||
$this->message->addPart(
|
||||
(new DataPart(new File($file), $cid))->asInline()
|
||||
);
|
||||
|
||||
return "cid:$cid";
|
||||
}
|
||||
|
||||
/**
|
||||
* Embed in-memory data in the message and get the CID.
|
||||
*
|
||||
* @param string|resource $data
|
||||
* @param string $name
|
||||
* @param string|null $contentType
|
||||
* @return string
|
||||
*/
|
||||
public function embedData($data, $name, $contentType = null)
|
||||
{
|
||||
$this->message->addPart(
|
||||
(new DataPart($data, $name, $contentType))->asInline()
|
||||
);
|
||||
|
||||
return "cid:$name";
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the underlying Symfony Email instance.
|
||||
*
|
||||
* @return \Symfony\Component\Mime\Email
|
||||
*/
|
||||
public function getSymfonyMessage()
|
||||
{
|
||||
return $this->message;
|
||||
}
|
||||
|
||||
/**
|
||||
* Dynamically pass missing methods to the Symfony instance.
|
||||
*
|
||||
* @param string $method
|
||||
* @param array $parameters
|
||||
* @return mixed
|
||||
*/
|
||||
public function __call($method, $parameters)
|
||||
{
|
||||
return $this->forwardDecoratedCallTo($this->message, $method, $parameters);
|
||||
}
|
||||
}
|
||||
177
vendor/laravel/framework/src/Illuminate/Mail/PendingMail.php
vendored
Normal file
177
vendor/laravel/framework/src/Illuminate/Mail/PendingMail.php
vendored
Normal file
@@ -0,0 +1,177 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Mail;
|
||||
|
||||
use Illuminate\Contracts\Mail\Mailable as MailableContract;
|
||||
use Illuminate\Contracts\Mail\Mailer as MailerContract;
|
||||
use Illuminate\Contracts\Translation\HasLocalePreference;
|
||||
use Illuminate\Support\Traits\Conditionable;
|
||||
|
||||
class PendingMail
|
||||
{
|
||||
use Conditionable;
|
||||
|
||||
/**
|
||||
* 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 \Illuminate\Mail\SentMessage|null
|
||||
*/
|
||||
public function send(MailableContract $mailable)
|
||||
{
|
||||
return $this->mailer->send($this->fill($mailable));
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a new mailable message instance synchronously.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Mail\Mailable $mailable
|
||||
* @return \Illuminate\Mail\SentMessage|null
|
||||
*/
|
||||
public function sendNow(MailableContract $mailable)
|
||||
{
|
||||
return $this->mailer->sendNow($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 (n) seconds.
|
||||
*
|
||||
* @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);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
146
vendor/laravel/framework/src/Illuminate/Mail/SendQueuedMailable.php
vendored
Normal file
146
vendor/laravel/framework/src/Illuminate/Mail/SendQueuedMailable.php
vendored
Normal file
@@ -0,0 +1,146 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Mail;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Mail\Factory as MailFactory;
|
||||
use Illuminate\Contracts\Mail\Mailable as MailableContract;
|
||||
use Illuminate\Contracts\Queue\ShouldBeEncrypted;
|
||||
use Illuminate\Contracts\Queue\ShouldQueueAfterCommit;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
|
||||
class SendQueuedMailable
|
||||
{
|
||||
use Queueable, InteractsWithQueue;
|
||||
|
||||
/**
|
||||
* 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;
|
||||
|
||||
/**
|
||||
* The maximum number of unhandled exceptions to allow before failing.
|
||||
*
|
||||
* @return int|null
|
||||
*/
|
||||
public $maxExceptions;
|
||||
|
||||
/**
|
||||
* Indicates if the job should be encrypted.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
public $shouldBeEncrypted = false;
|
||||
|
||||
/**
|
||||
* Create a new job instance.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Mail\Mailable $mailable
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(MailableContract $mailable)
|
||||
{
|
||||
$this->mailable = $mailable;
|
||||
|
||||
if ($mailable instanceof ShouldQueueAfterCommit) {
|
||||
$this->afterCommit = true;
|
||||
} else {
|
||||
$this->afterCommit = property_exists($mailable, 'afterCommit') ? $mailable->afterCommit : null;
|
||||
}
|
||||
|
||||
$this->connection = property_exists($mailable, 'connection') ? $mailable->connection : null;
|
||||
$this->maxExceptions = property_exists($mailable, 'maxExceptions') ? $mailable->maxExceptions : null;
|
||||
$this->queue = property_exists($mailable, 'queue') ? $mailable->queue : null;
|
||||
$this->shouldBeEncrypted = $mailable instanceof ShouldBeEncrypted;
|
||||
$this->timeout = property_exists($mailable, 'timeout') ? $mailable->timeout : null;
|
||||
$this->tries = property_exists($mailable, 'tries') ? $mailable->tries : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the queued job.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Mail\Factory $factory
|
||||
* @return void
|
||||
*/
|
||||
public function handle(MailFactory $factory)
|
||||
{
|
||||
$this->mailable->send($factory);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the number of seconds before a released mailable will be available.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function backoff()
|
||||
{
|
||||
if (! method_exists($this->mailable, 'backoff') && ! isset($this->mailable->backoff)) {
|
||||
return;
|
||||
}
|
||||
|
||||
return $this->mailable->backoff ?? $this->mailable->backoff();
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine the time at which the job should timeout.
|
||||
*
|
||||
* @return \DateTime|null
|
||||
*/
|
||||
public function retryUntil()
|
||||
{
|
||||
if (! method_exists($this->mailable, 'retryUntil') && ! isset($this->mailable->retryUntil)) {
|
||||
return;
|
||||
}
|
||||
|
||||
return $this->mailable->retryUntil ?? $this->mailable->retryUntil();
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 display name for the queued job.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function displayName()
|
||||
{
|
||||
return get_class($this->mailable);
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare the instance for cloning.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __clone()
|
||||
{
|
||||
$this->mailable = clone $this->mailable;
|
||||
}
|
||||
}
|
||||
83
vendor/laravel/framework/src/Illuminate/Mail/SentMessage.php
vendored
Normal file
83
vendor/laravel/framework/src/Illuminate/Mail/SentMessage.php
vendored
Normal file
@@ -0,0 +1,83 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Mail;
|
||||
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Traits\ForwardsCalls;
|
||||
use Symfony\Component\Mailer\SentMessage as SymfonySentMessage;
|
||||
|
||||
/**
|
||||
* @mixin \Symfony\Component\Mailer\SentMessage
|
||||
*/
|
||||
class SentMessage
|
||||
{
|
||||
use ForwardsCalls;
|
||||
|
||||
/**
|
||||
* The Symfony SentMessage instance.
|
||||
*
|
||||
* @var \Symfony\Component\Mailer\SentMessage
|
||||
*/
|
||||
protected $sentMessage;
|
||||
|
||||
/**
|
||||
* Create a new SentMessage instance.
|
||||
*
|
||||
* @param \Symfony\Component\Mailer\SentMessage $sentMessage
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(SymfonySentMessage $sentMessage)
|
||||
{
|
||||
$this->sentMessage = $sentMessage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the underlying Symfony Email instance.
|
||||
*
|
||||
* @return \Symfony\Component\Mailer\SentMessage
|
||||
*/
|
||||
public function getSymfonySentMessage()
|
||||
{
|
||||
return $this->sentMessage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Dynamically pass missing methods to the Symfony instance.
|
||||
*
|
||||
* @param string $method
|
||||
* @param array $parameters
|
||||
* @return mixed
|
||||
*/
|
||||
public function __call($method, $parameters)
|
||||
{
|
||||
return $this->forwardCallTo($this->sentMessage, $method, $parameters);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the serializable representation of the object.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function __serialize()
|
||||
{
|
||||
$hasAttachments = (new Collection($this->sentMessage->getOriginalMessage()->getAttachments()))->isNotEmpty();
|
||||
|
||||
return [
|
||||
'hasAttachments' => $hasAttachments,
|
||||
'sentMessage' => $hasAttachments ? base64_encode(serialize($this->sentMessage)) : $this->sentMessage,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Marshal the object from its serialized data.
|
||||
*
|
||||
* @param array $data
|
||||
* @return void
|
||||
*/
|
||||
public function __unserialize(array $data)
|
||||
{
|
||||
$hasAttachments = ($data['hasAttachments'] ?? false) === true;
|
||||
|
||||
$this->sentMessage = $hasAttachments ? unserialize(base64_decode($data['sentMessage'])) : $data['sentMessage'];
|
||||
}
|
||||
}
|
||||
67
vendor/laravel/framework/src/Illuminate/Mail/TextMessage.php
vendored
Normal file
67
vendor/laravel/framework/src/Illuminate/Mail/TextMessage.php
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Mail;
|
||||
|
||||
use Illuminate\Support\Traits\ForwardsCalls;
|
||||
|
||||
/**
|
||||
* @mixin \Illuminate\Mail\Message
|
||||
*/
|
||||
class TextMessage
|
||||
{
|
||||
use ForwardsCalls;
|
||||
|
||||
/**
|
||||
* The underlying message instance.
|
||||
*
|
||||
* @var \Illuminate\Mail\Message
|
||||
*/
|
||||
protected $message;
|
||||
|
||||
/**
|
||||
* Create a new text message instance.
|
||||
*
|
||||
* @param \Illuminate\Mail\Message $message
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($message)
|
||||
{
|
||||
$this->message = $message;
|
||||
}
|
||||
|
||||
/**
|
||||
* Embed a file in the message and get the CID.
|
||||
*
|
||||
* @param string|\Illuminate\Contracts\Mail\Attachable|\Illuminate\Mail\Attachment $file
|
||||
* @return string
|
||||
*/
|
||||
public function embed($file)
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Embed in-memory data in the message and get the CID.
|
||||
*
|
||||
* @param string|resource $data
|
||||
* @param string $name
|
||||
* @param string|null $contentType
|
||||
* @return string
|
||||
*/
|
||||
public function embedData($data, $name, $contentType = null)
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Dynamically pass missing methods to the underlying message instance.
|
||||
*
|
||||
* @param string $method
|
||||
* @param array $parameters
|
||||
* @return mixed
|
||||
*/
|
||||
public function __call($method, $parameters)
|
||||
{
|
||||
return $this->forwardDecoratedCallTo($this->message, $method, $parameters);
|
||||
}
|
||||
}
|
||||
68
vendor/laravel/framework/src/Illuminate/Mail/Transport/ArrayTransport.php
vendored
Normal file
68
vendor/laravel/framework/src/Illuminate/Mail/Transport/ArrayTransport.php
vendored
Normal file
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Mail\Transport;
|
||||
|
||||
use Illuminate\Support\Collection;
|
||||
use Stringable;
|
||||
use Symfony\Component\Mailer\Envelope;
|
||||
use Symfony\Component\Mailer\SentMessage;
|
||||
use Symfony\Component\Mailer\Transport\TransportInterface;
|
||||
use Symfony\Component\Mime\RawMessage;
|
||||
|
||||
class ArrayTransport implements Stringable, TransportInterface
|
||||
{
|
||||
/**
|
||||
* The collection of Symfony 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(RawMessage $message, ?Envelope $envelope = null): ?SentMessage
|
||||
{
|
||||
return $this->messages[] = new SentMessage($message, $envelope ?? Envelope::create($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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the string representation of the transport.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString(): string
|
||||
{
|
||||
return 'array';
|
||||
}
|
||||
}
|
||||
99
vendor/laravel/framework/src/Illuminate/Mail/Transport/LogTransport.php
vendored
Normal file
99
vendor/laravel/framework/src/Illuminate/Mail/Transport/LogTransport.php
vendored
Normal file
@@ -0,0 +1,99 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Mail\Transport;
|
||||
|
||||
use Illuminate\Support\Str;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Stringable;
|
||||
use Symfony\Component\Mailer\Envelope;
|
||||
use Symfony\Component\Mailer\SentMessage;
|
||||
use Symfony\Component\Mailer\Transport\TransportInterface;
|
||||
use Symfony\Component\Mime\RawMessage;
|
||||
|
||||
class LogTransport implements Stringable, TransportInterface
|
||||
{
|
||||
/**
|
||||
* 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(RawMessage $message, ?Envelope $envelope = null): ?SentMessage
|
||||
{
|
||||
$string = Str::of($message->toString());
|
||||
|
||||
if ($string->contains('Content-Type: multipart/')) {
|
||||
$boundary = $string
|
||||
->after('boundary=')
|
||||
->before("\r\n")
|
||||
->prepend('--')
|
||||
->append("\r\n");
|
||||
|
||||
$string = $string
|
||||
->explode($boundary)
|
||||
->map($this->decodeQuotedPrintableContent(...))
|
||||
->implode($boundary);
|
||||
} elseif ($string->contains('Content-Transfer-Encoding: quoted-printable')) {
|
||||
$string = $this->decodeQuotedPrintableContent($string);
|
||||
}
|
||||
|
||||
$this->logger->debug((string) $string);
|
||||
|
||||
return new SentMessage($message, $envelope ?? Envelope::create($message));
|
||||
}
|
||||
|
||||
/**
|
||||
* Decode the given quoted printable content.
|
||||
*
|
||||
* @param string $part
|
||||
* @return string
|
||||
*/
|
||||
protected function decodeQuotedPrintableContent(string $part)
|
||||
{
|
||||
if (! str_contains($part, 'Content-Transfer-Encoding: quoted-printable')) {
|
||||
return $part;
|
||||
}
|
||||
|
||||
[$headers, $content] = explode("\r\n\r\n", $part, 2);
|
||||
|
||||
return implode("\r\n\r\n", [
|
||||
$headers,
|
||||
quoted_printable_decode($content),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the logger for the LogTransport instance.
|
||||
*
|
||||
* @return \Psr\Log\LoggerInterface
|
||||
*/
|
||||
public function logger()
|
||||
{
|
||||
return $this->logger;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the string representation of the transport.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString(): string
|
||||
{
|
||||
return 'log';
|
||||
}
|
||||
}
|
||||
130
vendor/laravel/framework/src/Illuminate/Mail/Transport/ResendTransport.php
vendored
Normal file
130
vendor/laravel/framework/src/Illuminate/Mail/Transport/ResendTransport.php
vendored
Normal file
@@ -0,0 +1,130 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Mail\Transport;
|
||||
|
||||
use Exception;
|
||||
use Resend\Contracts\Client;
|
||||
use Symfony\Component\Mailer\Envelope;
|
||||
use Symfony\Component\Mailer\Exception\TransportException;
|
||||
use Symfony\Component\Mailer\SentMessage;
|
||||
use Symfony\Component\Mailer\Transport\AbstractTransport;
|
||||
use Symfony\Component\Mime\Address;
|
||||
use Symfony\Component\Mime\Email;
|
||||
use Symfony\Component\Mime\MessageConverter;
|
||||
|
||||
/*
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2023 Jayan Ratna
|
||||
|
||||
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.
|
||||
*/
|
||||
class ResendTransport extends AbstractTransport
|
||||
{
|
||||
/**
|
||||
* Create a new Resend transport instance.
|
||||
*/
|
||||
public function __construct(protected Client $resend)
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function doSend(SentMessage $message): void
|
||||
{
|
||||
$email = MessageConverter::toEmail($message->getOriginalMessage());
|
||||
|
||||
$envelope = $message->getEnvelope();
|
||||
|
||||
$headers = [];
|
||||
|
||||
$headersToBypass = ['from', 'to', 'cc', 'bcc', 'reply-to', 'sender', 'subject', 'content-type'];
|
||||
|
||||
foreach ($email->getHeaders()->all() as $name => $header) {
|
||||
if (in_array($name, $headersToBypass, true)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$headers[$header->getName()] = $header->getBodyAsString();
|
||||
}
|
||||
|
||||
$attachments = [];
|
||||
|
||||
if ($email->getAttachments()) {
|
||||
foreach ($email->getAttachments() as $attachment) {
|
||||
$attachmentHeaders = $attachment->getPreparedHeaders();
|
||||
|
||||
$filename = $attachmentHeaders->getHeaderParameter('Content-Disposition', 'filename');
|
||||
|
||||
$item = [
|
||||
'content_type' => $attachmentHeaders->get('Content-Type')->getBody(),
|
||||
'content' => str_replace("\r\n", '', $attachment->bodyToString()),
|
||||
'filename' => $filename,
|
||||
];
|
||||
|
||||
$attachments[] = $item;
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
$result = $this->resend->emails->send([
|
||||
'from' => $envelope->getSender()->toString(),
|
||||
'to' => $this->stringifyAddresses($this->getRecipients($email, $envelope)),
|
||||
'cc' => $this->stringifyAddresses($email->getCc()),
|
||||
'bcc' => $this->stringifyAddresses($email->getBcc()),
|
||||
'reply_to' => $this->stringifyAddresses($email->getReplyTo()),
|
||||
'headers' => $headers,
|
||||
'subject' => $email->getSubject(),
|
||||
'html' => $email->getHtmlBody(),
|
||||
'text' => $email->getTextBody(),
|
||||
'attachments' => $attachments,
|
||||
]);
|
||||
} catch (Exception $exception) {
|
||||
throw new TransportException(
|
||||
sprintf('Request to Resend API failed. Reason: %s.', $exception->getMessage()),
|
||||
is_int($exception->getCode()) ? $exception->getCode() : 0,
|
||||
$exception
|
||||
);
|
||||
}
|
||||
|
||||
$messageId = $result->id;
|
||||
|
||||
$email->getHeaders()->addHeader('X-Resend-Email-ID', $messageId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the recipients without CC or BCC.
|
||||
*/
|
||||
protected function getRecipients(Email $email, Envelope $envelope): array
|
||||
{
|
||||
return array_filter($envelope->getRecipients(), function (Address $address) use ($email) {
|
||||
return in_array($address, array_merge($email->getCc(), $email->getBcc()), true) === false;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the string representation of the transport.
|
||||
*/
|
||||
public function __toString(): string
|
||||
{
|
||||
return 'resend';
|
||||
}
|
||||
}
|
||||
152
vendor/laravel/framework/src/Illuminate/Mail/Transport/SesTransport.php
vendored
Normal file
152
vendor/laravel/framework/src/Illuminate/Mail/Transport/SesTransport.php
vendored
Normal file
@@ -0,0 +1,152 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Mail\Transport;
|
||||
|
||||
use Aws\Exception\AwsException;
|
||||
use Aws\Ses\SesClient;
|
||||
use Illuminate\Support\Collection;
|
||||
use Stringable;
|
||||
use Symfony\Component\Mailer\Exception\TransportException;
|
||||
use Symfony\Component\Mailer\Header\MetadataHeader;
|
||||
use Symfony\Component\Mailer\SentMessage;
|
||||
use Symfony\Component\Mailer\Transport\AbstractTransport;
|
||||
use Symfony\Component\Mime\Message;
|
||||
|
||||
class SesTransport extends AbstractTransport implements Stringable
|
||||
{
|
||||
/**
|
||||
* 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;
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function doSend(SentMessage $message): void
|
||||
{
|
||||
$options = $this->options;
|
||||
|
||||
if ($message->getOriginalMessage() instanceof Message) {
|
||||
if ($listManagementOptions = $this->listManagementOptions($message)) {
|
||||
$options['ListManagementOptions'] = $listManagementOptions;
|
||||
}
|
||||
|
||||
foreach ($message->getOriginalMessage()->getHeaders()->all() as $header) {
|
||||
if ($header instanceof MetadataHeader) {
|
||||
$options['Tags'][] = ['Name' => $header->getKey(), 'Value' => $header->getValue()];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
$result = $this->ses->sendRawEmail(
|
||||
array_merge(
|
||||
$options, [
|
||||
'Source' => $message->getEnvelope()->getSender()->toString(),
|
||||
'Destinations' => (new Collection($message->getEnvelope()->getRecipients()))
|
||||
->map
|
||||
->toString()
|
||||
->values()
|
||||
->all(),
|
||||
'RawMessage' => [
|
||||
'Data' => $message->toString(),
|
||||
],
|
||||
]
|
||||
)
|
||||
);
|
||||
} catch (AwsException $e) {
|
||||
$reason = $e->getAwsErrorMessage() ?? $e->getMessage();
|
||||
|
||||
throw new TransportException(
|
||||
sprintf('Request to AWS SES API failed. Reason: %s.', $reason),
|
||||
is_int($e->getCode()) ? $e->getCode() : 0,
|
||||
$e
|
||||
);
|
||||
}
|
||||
|
||||
$messageId = $result->get('MessageId');
|
||||
|
||||
$message->getOriginalMessage()->getHeaders()->addHeader('X-Message-ID', $messageId);
|
||||
$message->getOriginalMessage()->getHeaders()->addHeader('X-SES-Message-ID', $messageId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Extract the SES list management options, if applicable.
|
||||
*
|
||||
* @param \Symfony\Component\Mailer\SentMessage $message
|
||||
* @return array|null
|
||||
*/
|
||||
protected function listManagementOptions(SentMessage $message)
|
||||
{
|
||||
if ($header = $message->getOriginalMessage()->getHeaders()->get('X-SES-LIST-MANAGEMENT-OPTIONS')) {
|
||||
if (preg_match("/^(contactListName=)*(?<ContactListName>[^;]+)(;\s?topicName=(?<TopicName>.+))?$/ix", $header->getBodyAsString(), $listManagementOptions)) {
|
||||
return array_filter($listManagementOptions, fn ($e) => in_array($e, ['ContactListName', 'TopicName']), ARRAY_FILTER_USE_KEY);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the string representation of the transport.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString(): string
|
||||
{
|
||||
return 'ses';
|
||||
}
|
||||
}
|
||||
156
vendor/laravel/framework/src/Illuminate/Mail/Transport/SesV2Transport.php
vendored
Normal file
156
vendor/laravel/framework/src/Illuminate/Mail/Transport/SesV2Transport.php
vendored
Normal file
@@ -0,0 +1,156 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Mail\Transport;
|
||||
|
||||
use Aws\Exception\AwsException;
|
||||
use Aws\SesV2\SesV2Client;
|
||||
use Illuminate\Support\Collection;
|
||||
use Stringable;
|
||||
use Symfony\Component\Mailer\Exception\TransportException;
|
||||
use Symfony\Component\Mailer\Header\MetadataHeader;
|
||||
use Symfony\Component\Mailer\SentMessage;
|
||||
use Symfony\Component\Mailer\Transport\AbstractTransport;
|
||||
use Symfony\Component\Mime\Message;
|
||||
|
||||
class SesV2Transport extends AbstractTransport implements Stringable
|
||||
{
|
||||
/**
|
||||
* The Amazon SES V2 instance.
|
||||
*
|
||||
* @var \Aws\SesV2\SesV2Client
|
||||
*/
|
||||
protected $ses;
|
||||
|
||||
/**
|
||||
* The Amazon SES transmission options.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $options = [];
|
||||
|
||||
/**
|
||||
* Create a new SES V2 transport instance.
|
||||
*
|
||||
* @param \Aws\SesV2\SesV2Client $ses
|
||||
* @param array $options
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(SesV2Client $ses, $options = [])
|
||||
{
|
||||
$this->ses = $ses;
|
||||
$this->options = $options;
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function doSend(SentMessage $message): void
|
||||
{
|
||||
$options = $this->options;
|
||||
|
||||
if ($message->getOriginalMessage() instanceof Message) {
|
||||
if ($listManagementOptions = $this->listManagementOptions($message)) {
|
||||
$options['ListManagementOptions'] = $listManagementOptions;
|
||||
}
|
||||
|
||||
foreach ($message->getOriginalMessage()->getHeaders()->all() as $header) {
|
||||
if ($header instanceof MetadataHeader) {
|
||||
$options['EmailTags'][] = ['Name' => $header->getKey(), 'Value' => $header->getValue()];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
$result = $this->ses->sendEmail(
|
||||
array_merge(
|
||||
$options, [
|
||||
'Source' => $message->getEnvelope()->getSender()->toString(),
|
||||
'Destination' => [
|
||||
'ToAddresses' => (new Collection($message->getEnvelope()->getRecipients()))
|
||||
->map
|
||||
->toString()
|
||||
->values()
|
||||
->all(),
|
||||
],
|
||||
'Content' => [
|
||||
'Raw' => [
|
||||
'Data' => $message->toString(),
|
||||
],
|
||||
],
|
||||
]
|
||||
)
|
||||
);
|
||||
} catch (AwsException $e) {
|
||||
$reason = $e->getAwsErrorMessage() ?? $e->getMessage();
|
||||
|
||||
throw new TransportException(
|
||||
sprintf('Request to AWS SES V2 API failed. Reason: %s.', $reason),
|
||||
is_int($e->getCode()) ? $e->getCode() : 0,
|
||||
$e
|
||||
);
|
||||
}
|
||||
|
||||
$messageId = $result->get('MessageId');
|
||||
|
||||
$message->getOriginalMessage()->getHeaders()->addHeader('X-Message-ID', $messageId);
|
||||
$message->getOriginalMessage()->getHeaders()->addHeader('X-SES-Message-ID', $messageId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Extract the SES list managenent options, if applicable.
|
||||
*
|
||||
* @param \Illuminate\Mail\SentMessage $message
|
||||
* @return array|null
|
||||
*/
|
||||
protected function listManagementOptions(SentMessage $message)
|
||||
{
|
||||
if ($header = $message->getOriginalMessage()->getHeaders()->get('X-SES-LIST-MANAGEMENT-OPTIONS')) {
|
||||
if (preg_match("/^(contactListName=)*(?<ContactListName>[^;]+)(;\s?topicName=(?<TopicName>.+))?$/ix", $header->getBodyAsString(), $listManagementOptions)) {
|
||||
return array_filter($listManagementOptions, fn ($e) => in_array($e, ['ContactListName', 'TopicName']), ARRAY_FILTER_USE_KEY);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Amazon SES V2 client for the SesV2Transport instance.
|
||||
*
|
||||
* @return \Aws\SesV2\SesV2Client
|
||||
*/
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the string representation of the transport.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString(): string
|
||||
{
|
||||
return 'ses-v2';
|
||||
}
|
||||
}
|
||||
49
vendor/laravel/framework/src/Illuminate/Mail/composer.json
vendored
Executable file
49
vendor/laravel/framework/src/Illuminate/Mail/composer.json
vendored
Executable file
@@ -0,0 +1,49 @@
|
||||
{
|
||||
"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": "^8.2",
|
||||
"illuminate/collections": "^11.0",
|
||||
"illuminate/container": "^11.0",
|
||||
"illuminate/contracts": "^11.0",
|
||||
"illuminate/macroable": "^11.0",
|
||||
"illuminate/support": "^11.0",
|
||||
"league/commonmark": "^2.6",
|
||||
"psr/log": "^1.0|^2.0|^3.0",
|
||||
"symfony/mailer": "^7.0.3",
|
||||
"tijsverkoyen/css-to-inline-styles": "^2.2.5"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Illuminate\\Mail\\": ""
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "11.x-dev"
|
||||
}
|
||||
},
|
||||
"suggest": {
|
||||
"aws/aws-sdk-php": "Required to use the SES mail driver (^3.322.9).",
|
||||
"resend/resend-php": "Required to enable support for the Resend mail transport (^0.10.0).",
|
||||
"symfony/http-client": "Required to use the Symfony API mail transports (^7.0).",
|
||||
"symfony/mailgun-mailer": "Required to enable support for the Mailgun mail transport (^7.0).",
|
||||
"symfony/postmark-mailer": "Required to enable support for the Postmark mail transport (^7.0)."
|
||||
},
|
||||
"config": {
|
||||
"sort-packages": true
|
||||
},
|
||||
"minimum-stability": "dev"
|
||||
}
|
||||
24
vendor/laravel/framework/src/Illuminate/Mail/resources/views/html/button.blade.php
vendored
Normal file
24
vendor/laravel/framework/src/Illuminate/Mail/resources/views/html/button.blade.php
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
@props([
|
||||
'url',
|
||||
'color' => 'primary',
|
||||
'align' => 'center',
|
||||
])
|
||||
<table class="action" align="{{ $align }}" width="100%" cellpadding="0" cellspacing="0" role="presentation">
|
||||
<tr>
|
||||
<td align="{{ $align }}">
|
||||
<table width="100%" border="0" cellpadding="0" cellspacing="0" role="presentation">
|
||||
<tr>
|
||||
<td align="{{ $align }}">
|
||||
<table border="0" cellpadding="0" cellspacing="0" role="presentation">
|
||||
<tr>
|
||||
<td>
|
||||
<a href="{{ $url }}" class="button button-{{ $color }}" 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>
|
||||
12
vendor/laravel/framework/src/Illuminate/Mail/resources/views/html/header.blade.php
vendored
Normal file
12
vendor/laravel/framework/src/Illuminate/Mail/resources/views/html/header.blade.php
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
@props(['url'])
|
||||
<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>
|
||||
58
vendor/laravel/framework/src/Illuminate/Mail/resources/views/html/layout.blade.php
vendored
Normal file
58
vendor/laravel/framework/src/Illuminate/Mail/resources/views/html/layout.blade.php
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
<!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>
|
||||
<title>{{ config('app.name') }}</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
<meta name="color-scheme" content="light">
|
||||
<meta name="supported-color-schemes" content="light">
|
||||
<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>
|
||||
{{ $head ?? '' }}
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<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" style="border: hidden !important;">
|
||||
<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 @@
|
||||
<x-mail::layout>
|
||||
{{-- Header --}}
|
||||
<x-slot:header>
|
||||
<x-mail::header :url="config('app.url')">
|
||||
{{ config('app.name') }}
|
||||
</x-mail::header>
|
||||
</x-slot:header>
|
||||
|
||||
{{-- Body --}}
|
||||
{{ $slot }}
|
||||
|
||||
{{-- Subcopy --}}
|
||||
@isset($subcopy)
|
||||
<x-slot:subcopy>
|
||||
<x-mail::subcopy>
|
||||
{{ $subcopy }}
|
||||
</x-mail::subcopy>
|
||||
</x-slot:subcopy>
|
||||
@endisset
|
||||
|
||||
{{-- Footer --}}
|
||||
<x-slot:footer>
|
||||
<x-mail::footer>
|
||||
© {{ date('Y') }} {{ config('app.name') }}. {{ __('All rights reserved.') }}
|
||||
</x-mail::footer>
|
||||
</x-slot:footer>
|
||||
</x-mail::layout>
|
||||
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>
|
||||
295
vendor/laravel/framework/src/Illuminate/Mail/resources/views/html/themes/default.css
vendored
Normal file
295
vendor/laravel/framework/src/Illuminate/Mail/resources/views/html/themes/default.css
vendored
Normal file
@@ -0,0 +1,295 @@
|
||||
/* 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;
|
||||
max-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;
|
||||
}
|
||||
|
||||
.inner-body a {
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
/* 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%;
|
||||
float: unset;
|
||||
}
|
||||
|
||||
.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 @@
|
||||
<x-mail::layout>
|
||||
{{-- Header --}}
|
||||
<x-slot:header>
|
||||
<x-mail::header :url="config('app.url')">
|
||||
{{ config('app.name') }}
|
||||
</x-mail::header>
|
||||
</x-slot:header>
|
||||
|
||||
{{-- Body --}}
|
||||
{{ $slot }}
|
||||
|
||||
{{-- Subcopy --}}
|
||||
@isset($subcopy)
|
||||
<x-slot:subcopy>
|
||||
<x-mail::subcopy>
|
||||
{{ $subcopy }}
|
||||
</x-mail::subcopy>
|
||||
</x-slot:subcopy>
|
||||
@endisset
|
||||
|
||||
{{-- Footer --}}
|
||||
<x-slot:footer>
|
||||
<x-mail::footer>
|
||||
© {{ date('Y') }} {{ config('app.name') }}. @lang('All rights reserved.')
|
||||
</x-mail::footer>
|
||||
</x-slot:footer>
|
||||
</x-mail::layout>
|
||||
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