Skip to content

Commit

Permalink
Add getCustomSenderName logic
Browse files Browse the repository at this point in the history
  • Loading branch information
Dumazeau committed Aug 28, 2024
1 parent af86ce3 commit cb99611
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/Domain/Email/AbstractEmail.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ abstract class AbstractEmail
{
public const TEMPLATES = [Constant::DEFAULT_TEMPLATE];
public const EMAIL_SLUG_HEADER = 'abstract-email-slug';
public const CUSTOM_SENDER_NAME_HEADER = 'custom-sender-name';

protected const BODY_TYPE = self::BODY_TYPE_TRANSLATION;

Expand Down Expand Up @@ -141,6 +142,11 @@ protected function customSubjectParameters(): array
return [];
}

protected function getCustomSenderName(): ?string
{
return null;
}

protected function getBody(): string
{
if (static::BODY_TYPE === static::BODY_TYPE_TRANSLATION) {
Expand Down Expand Up @@ -236,6 +242,10 @@ final protected function getEmail(): ?Email
}
}

if ($this->getCustomSenderName() !== null) {
$email->getHeaders()->addTextHeader(self::CUSTOM_SENDER_NAME_HEADER, $this->getCustomSenderName());
}

$this->emailUpdater($email);

return $email;
Expand Down

0 comments on commit cb99611

Please sign in to comment.