From 9cd283bf2c0e333311dc40177e4ce41bcfb09a4b Mon Sep 17 00:00:00 2001 From: David Rodrigues Date: Tue, 8 Feb 2022 16:39:15 -0300 Subject: [PATCH] Update Mailable.php Allow `->from(new Address($address, $name))` support again (was `->from($address, $name)` in Laravel 8). --- src/Illuminate/Mail/Mailable.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Illuminate/Mail/Mailable.php b/src/Illuminate/Mail/Mailable.php index 27f5b0fe155b..f2a7dc7a772a 100644 --- a/src/Illuminate/Mail/Mailable.php +++ b/src/Illuminate/Mail/Mailable.php @@ -22,6 +22,7 @@ use ReflectionProperty; use Symfony\Component\Mailer\Header\MetadataHeader; use Symfony\Component\Mailer\Header\TagHeader; +use Symfony\Component\Mime\Address; use Symfony\Component\Mime\Email; class Mailable implements MailableContract, Renderable @@ -675,6 +676,8 @@ protected function normalizeRecipient($recipient) return (object) $recipient; } elseif (is_string($recipient)) { return (object) ['email' => $recipient]; + } elseif ($recipient instanceof Address) { + return (object) ['email' => $recipient->getAddress(), 'name' => $recipient->getName()]; } return $recipient;