Skip to content

Commit

Permalink
Add unique on email to / cc / bcc / from
Browse files Browse the repository at this point in the history
  • Loading branch information
Dumazeau committed Nov 2, 2022
1 parent 2755f4c commit fe061f7
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Domain/Email/AbstractEmail.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,18 +147,18 @@ final protected function getEmail(): ?Email
$email = new Email();
$email->subject($this->getSubject())
->html($this->getBody())
->to(...$to);
->to(...\array_unique($to));

if (!empty($this->getCc())) {
$email->cc(...$this->getCc());
$email->cc(...\array_unique($this->getCc()));
}

if (!empty($this->getBcc())) {
$email->bcc(...$this->getBcc());
$email->bcc(...\array_unique($this->getBcc()));
}

if (!empty($this->getFrom())) {
$email->from(...$this->getFrom());
$email->from(...\array_unique($this->getFrom()));
}

foreach ($this->getAttachments() as $attachment) {
Expand Down

0 comments on commit fe061f7

Please sign in to comment.