Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
Baspa committed Sep 27, 2024
1 parent 5007141 commit 3cd6efd
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions src/Jobs/ResendMailJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,28 +56,21 @@ private function setMessageContent(Message $message): self
private function setMessageRecipients(Message $message): self
{
$message->subject($this->mail->subject ?? '')
->from($this->getFirstAddress($this->mail->from))
->from(array_keys($this->mail->from)[0], array_values($this->mail->from)[0])
->to($this->to);

if ($this->mail->cc || $this->cc) {
if ($this->mail->cc || count($this->cc) > 0) {
$message->cc($this->mail->cc ?? $this->cc);
}

if ($this->mail->bcc || $this->bcc) {
if ($this->mail->bcc || count($this->bcc) > 0) {
$message->bcc($this->mail->bcc ?? $this->bcc);
}

if ($this->mail->reply_to || $this->replyTo) {
$message->replyTo($this->getFirstAddress($this->mail->reply_to ?? $this->replyTo));
$message->replyTo($this->mail->reply_to ?? $this->replyTo);
}

return $this;
}

private function getFirstAddress(string $jsonAddresses): string
{
$addresses = json_decode($jsonAddresses, true);

return array_key_first($addresses);
}
}

0 comments on commit 3cd6efd

Please sign in to comment.