File tree Expand file tree Collapse file tree 4 files changed +11
-7
lines changed Expand file tree Collapse file tree 4 files changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -152,13 +152,15 @@ public function send(): Email
152152 (new MailableReader ())->read ($ this );
153153 }
154154
155- if (! $ this ->email ->from ) {
156- $ this ->email ->from = [
157- 'address ' => config ('mail.from.address ' ),
158- 'name ' => config ('mail.from.name ' ),
159- ];
155+ if (! is_array ($ this ->email ->from )) {
156+ $ this ->email ->from = [];
160157 }
161158
159+ $ this ->email ->from = [
160+ 'name ' => $ this ->email ->from ['name ' ] ?? config ('mail.from.name ' ),
161+ 'address ' => $ this ->email ->from ['address ' ] ?? config ('mail.from.address ' ),
162+ ];
163+
162164 $ this ->email ->save ();
163165
164166 $ this ->email ->refresh ();
Original file line number Diff line number Diff line change @@ -106,7 +106,7 @@ public function it_extracts_the_from_address_and_or_name()
106106
107107 $ this ->assertTrue ((bool ) $ email ->from );
108108 $ this ->assertEquals ('marick@dolphiq.nl ' , $ email ->from ['address ' ]);
109- $ this ->assertEquals (null , $ email ->from ['name ' ]);
109+ $ this ->assertEquals (' Laravel ' , $ email ->from ['name ' ]);
110110
111111 $ email = Email::compose ()->mailable (
112112 ($ this ->mailable ())
Original file line number Diff line number Diff line change @@ -68,7 +68,7 @@ public function the_email_has_a_correct_from_email_and_from_name()
6868 $ this ->artisan ('email:send ' );
6969 $ from = reset ($ this ->sent )->from ;
7070 $ this ->assertEquals ('marick@dolphiq.nl ' , key ($ from ));
71- $ this ->assertEquals (null , $ from [key ($ from )]);
71+ $ this ->assertEquals (' From CI test ' , $ from [key ($ from )]);
7272 }
7373
7474 #[Test]
Original file line number Diff line number Diff line change @@ -86,6 +86,8 @@ protected function getEnvironmentSetUp($app)
8686 ]);
8787
8888 $ app ['config ' ]->set ('mail.driver ' , 'log ' );
89+
90+ $ app ['config ' ]->set ('mail.from.name ' , 'Laravel ' );
8991 }
9092
9193 public function createEmail ($ overwrite = [])
You can’t perform that action at this time.
0 commit comments