Skip to content

Commit

Permalink
#9084 Mailable subject construction removing any html chars
Browse files Browse the repository at this point in the history
  • Loading branch information
touhidurabir authored and asmecher committed Jun 16, 2023
1 parent 6490b4e commit e6d3f17
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion classes/mail/Mailable.php
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,11 @@ protected function addFooter(string $locale): self
protected function buildSubject($message): self
{
$this->subject ??= ''; // Allow email with empty subject if not set
$subject = app('mailer')->compileParams($this->subject, $this->viewData);
$withoutTagViewData = collect($this->viewData)
->map(fn(mixed $viewableData) => is_string($viewableData) ? strip_tags($viewableData) : $viewableData)
->toArray();

$subject = app('mailer')->compileParams($this->subject, $withoutTagViewData);
if (empty($subject)) {
trigger_error(
'You are sending ' . static::getName() ?? static::class . ' email with empty subject',
Expand Down

0 comments on commit e6d3f17

Please sign in to comment.