Skip to content

Commit

Permalink
Remove name requirement for CC/BCC
Browse files Browse the repository at this point in the history
  • Loading branch information
abnegate committed Oct 7, 2024
1 parent 6e466d3 commit 050f696
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/Utopia/Messaging/Adapter/Email/SMTP.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,13 @@ protected function process(EmailMessage $message): array

if (!empty($message->getCC())) {
foreach ($message->getCC() as $cc) {
$mail->addCC($cc['email'], $cc['name']);
$mail->addCC($cc['email'], $cc['name'] ?? '');
}
}

if (!empty($message->getBCC())) {
foreach ($message->getBCC() as $bcc) {
$mail->addBCC($bcc['email'], $bcc['name']);
$mail->addBCC($bcc['email'], $bcc['name'] ?? '');
}
}

Expand Down
8 changes: 4 additions & 4 deletions src/Utopia/Messaging/Messages/Email.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,16 @@ public function __construct(

if (!\is_null($this->cc)) {
foreach ($this->cc as $recipient) {
if (!isset($recipient['name']) || !isset($recipient['email'])) {
throw new \InvalidArgumentException('Each recipient in cc must have a name and email');
if (!isset($recipient['email'])) {
throw new \InvalidArgumentException('Each CC recipient must have at least an email');
}
}
}

if (!\is_null($this->bcc)) {
foreach ($this->bcc as $recipient) {
if (!isset($recipient['name']) || !isset($recipient['email'])) {
throw new \InvalidArgumentException('Each recipient in bcc must have a name and email');
if (!isset($recipient['email'])) {
throw new \InvalidArgumentException('Each BCC recipient must have at least an email');
}
}
}
Expand Down

0 comments on commit 050f696

Please sign in to comment.