Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Add Wrapper for Symfony SentMessage #38803

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Sep 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion 2 src/Illuminate/Mail/Mailable.php
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ class Mailable implements MailableContract, Renderable
* Send the message using the given mailer.
*
* @param \Illuminate\Contracts\Mail\Factory|\Illuminate\Contracts\Mail\Mailer $mailer
* @return \Symfony\Component\Mailer\SentMessage|null
* @return \Illuminate\Mail\SentMessage|null
*/
public function send($mailer)
{
Expand Down
12 changes: 6 additions & 6 deletions 12 src/Illuminate/Mail/Mailer.php
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ public function bcc($users)
*
* @param string $html
* @param mixed $callback
* @return \Symfony\Component\Mailer\SentMessage|null
* @return \Illuminate\Mail\SentMessage|null
*/
public function html($html, $callback)
{
Expand All @@ -200,7 +200,7 @@ public function html($html, $callback)
*
* @param string $text
* @param mixed $callback
* @return \Symfony\Component\Mailer\SentMessage|null
* @return \Illuminate\Mail\SentMessage|null
*/
public function raw($text, $callback)
{
Expand All @@ -213,7 +213,7 @@ public function raw($text, $callback)
* @param string $view
* @param array $data
* @param mixed $callback
* @return \Symfony\Component\Mailer\SentMessage|null
* @return \Illuminate\Mail\SentMessage|null
*/
public function plain($view, array $data, $callback)
{
Expand Down Expand Up @@ -245,7 +245,7 @@ public function render($view, array $data = [])
* @param \Illuminate\Contracts\Mail\Mailable|string|array $view
* @param array $data
* @param \Closure|string|null $callback
* @return \Symfony\Component\Mailer\SentMessage|null
* @return \Illuminate\Mail\SentMessage|null
*/
public function send($view, array $data = [], $callback = null)
{
Expand Down Expand Up @@ -286,15 +286,15 @@ public function send($view, array $data = [], $callback = null)

$this->dispatchSentEvent($message, $data);

return $sentMessage;
return $sentMessage === null ? null : new SentMessage($sentMessage);
}
}

/**
* Send the given mailable.
*
* @param \Illuminate\Contracts\Mail\Mailable $mailable
* @return mixed
* @return \Illuminate\Mail\SentMessage|null
*/
protected function sendMailable(MailableContract $mailable)
{
Expand Down
54 changes: 54 additions & 0 deletions 54 src/Illuminate/Mail/SentMessage.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<?php

namespace Illuminate\Mail;

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);
}
}
8 changes: 4 additions & 4 deletions 8 src/Illuminate/Support/Facades/Mail.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
* @method static \Illuminate\Mail\PendingMail to($users)
* @method static \Illuminate\Support\Collection queued(string $mailable, \Closure|string $callback = null)
* @method static \Illuminate\Support\Collection sent(string $mailable, \Closure|string $callback = null)
* @method static \Symfony\Component\Mailer\SentMessage|null raw(string $text, $callback)
* @method static \Symfony\Component\Mailer\SentMessage|null plain(string $view, array $data, $callback)
* @method static \Symfony\Component\Mailer\SentMessage|null html(string $html, $callback)
* @method static \Symfony\Component\Mailer\SentMessage|null send(\Illuminate\Contracts\Mail\Mailable|string|array $view, array $data = [], \Closure|string $callback = null)
* @method static \Illuminate\Mail\SentMessage|null raw(string $text, $callback)
* @method static \Illuminate\Mail\SentMessage|null plain(string $view, array $data, $callback)
* @method static \Illuminate\Mail\SentMessage|null html(string $html, $callback)
* @method static \Illuminate\Mail\SentMessage|null send(\Illuminate\Contracts\Mail\Mailable|string|array $view, array $data = [], \Closure|string $callback = null)
* @method static array failures()
* @method static bool hasQueued(string $mailable)
* @method static bool hasSent(string $mailable)
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.