Skip to content

Commit

Permalink
Merge pull request #27 from DTS-And-Eaglepoint-Funding/master
Browse files Browse the repository at this point in the history
handle text emails and emails with null body
  • Loading branch information
dcblogdev authored Feb 13, 2025
2 parents e03a91f + 3102e65 commit ab1735c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Listeners/EmailLogger.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ class EmailLogger
public function handle(MessageSending $event): void
{
$message = $event->message;

$body = $message->getHtmlBody() ?: $message->getTextBody() ?: '';
$email = SentEmail::create([
'date' => date('Y-m-d H:i:s'),
'from' => $this->formatAddressField($message->getFrom()),
'to' => $this->formatAddressField($message->getTo()),
'cc' => $this->formatAddressField($message->getCc()),
'bcc' => $this->formatAddressField($message->getBcc()),
'subject' => $message->getSubject(),
'body' => $message->getHtmlBody(),
'body' => $body,
]);

if (config('sentemails.storeAttachments')) {
Expand Down

0 comments on commit ab1735c

Please sign in to comment.