Skip to content

Commit daab6d2

Browse files
committed
wip
1 parent d622484 commit daab6d2

File tree

3 files changed

+27
-7
lines changed

3 files changed

+27
-7
lines changed

packages/mailer/src/Mailer.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,13 @@ private function makeEmail(string $header, string $body): Email
4545

4646
[$name, $value] = explode(':', $header);
4747

48-
$parsedHeaders[trim($name)] = trim($value);
48+
$value = trim($value);
49+
50+
if ($value === '') {
51+
$value = null;
52+
}
53+
54+
$parsedHeaders[trim($name)] = $value;
4955
}
5056

5157
$parsedHeaders['attachments'] = explode(',', $parsedHeaders['attachments'] ?? '');

tests/Integration/Mailer/MailerTest.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,15 @@ public function test_mailer(): void
1111
{
1212
$mailer = $this->container->get(Mailer::class);
1313

14+
$user = (object) [
15+
'email' => '[email protected]',
16+
'name' => 'Brent Roose',
17+
'first_name' => 'Brent',
18+
];
19+
1420
$mailer->send(
1521
__DIR__ . '/test-mail.view.php',
16-
17-
18-
subject: 'Hello there',
19-
name: 'Brent',
22+
user: $user,
2023
files: [
2124
__DIR__ . '/Fixtures/attachment.txt',
2225
__DIR__ . '/test-mail.view.php',
Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1-
<x-mail :to="$to" :subject="$subject" :attachments="$files">
2-
Hello {{ $name }}
1+
<x-mail
2+
3+
:to="$user->email"
4+
:subject="'Welcome ' . $user->name"
5+
:attachments="$files"
6+
>
7+
Hello {{ $user->first_name }}
8+
9+
Thanks for checking out Tempest!
10+
11+
See you soon!
12+
13+
The Tempest Team
314
</x-mail>

0 commit comments

Comments
 (0)