Skip to content

Commit

Permalink
[Notification] fix postmark from
Browse files Browse the repository at this point in the history
  • Loading branch information
that-guy-iain committed Jun 19, 2024
1 parent 583633c commit a6df198
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Parthenon/Notification/Sender/PostmarkEmailSender.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
namespace Parthenon\Notification\Sender;

use Parthenon\Common\LoggerAwareTrait;
use Parthenon\Notification\Configuration;
use Parthenon\Notification\EmailInterface;
use Parthenon\Notification\EmailSenderInterface;
use Parthenon\Notification\Exception\UnableToSendMessageException;
Expand All @@ -32,7 +33,7 @@ final class PostmarkEmailSender implements EmailSenderInterface
{
use LoggerAwareTrait;

public function __construct(private PostmarkClient $postmarkClient)
public function __construct(private PostmarkClient $postmarkClient, private Configuration $configuration)
{
}

Expand All @@ -42,10 +43,11 @@ public function send(EmailInterface $message)
foreach ($message->getAttachments() as $attachment) {
$attachments[] = PostmarkAttachment::fromRawData($attachment->getContent(), $attachment->getName());
}
$from = $message->getFromAddress() ?? $this->configuration->getFromAddress();

$email = [
'To' => $message->getToAddress(),
'From' => $message->getFromAddress(),
'From' => $from,
'Subject' => $message->getSubject(),
'Attachments' => $attachments,
];
Expand Down
1 change: 1 addition & 0 deletions src/Parthenon/Resources/config/services/notification.xml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@

<service id="parthenon.notification.third_party.postmark_client" class="Postmark\PostmarkClient">
<argument>%parthenon_notification_email_postmark_apikey%</argument>
<argument type="service" id="Parthenon\Notification\Configuration" />
</service>
<service id="Parthenon\Notification\Sender\PostmarkEmailSender" class="Parthenon\Notification\Sender\PostmarkEmailSender">
<argument type="service" id="parthenon.notification.third_party.postmark_client" />
Expand Down

0 comments on commit a6df198

Please sign in to comment.