From cb9961141bd08af6b9b70799ea7fd25e645034e4 Mon Sep 17 00:00:00 2001 From: Dumazeau Date: Wed, 28 Aug 2024 16:37:52 +0200 Subject: [PATCH] Add getCustomSenderName logic --- src/Domain/Email/AbstractEmail.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/Domain/Email/AbstractEmail.php b/src/Domain/Email/AbstractEmail.php index c6a8d13..ce1aad0 100644 --- a/src/Domain/Email/AbstractEmail.php +++ b/src/Domain/Email/AbstractEmail.php @@ -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; @@ -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) { @@ -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;