From 5eda224d92559586a3aeff306d35b5a2a39ed771 Mon Sep 17 00:00:00 2001 From: Trayan Deneff Date: Thu, 9 May 2024 15:44:11 +0100 Subject: [PATCH] Allow CC emails when using SendGrid --- src/Service/SendGridService.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Service/SendGridService.php b/src/Service/SendGridService.php index d305321..e57b9d9 100644 --- a/src/Service/SendGridService.php +++ b/src/Service/SendGridService.php @@ -99,10 +99,6 @@ public function send(Message $message): array ); } - if (count($message->getCc())) { - throw new Exception\RuntimeException('SendGrid does not support CC addresses'); - } - $parameters = [ 'from' => $from->rewind()->getEmail(), 'fromname' => $from->rewind()->getName(), @@ -115,6 +111,10 @@ public function send(Message $message): array $parameters['to'][] = $address->getEmail(); } + foreach ($message->getCc() as $address) { + $parameters['cc'][] = $address->getEmail(); + } + foreach ($message->getBcc() as $address) { $parameters['bcc'][] = $address->getEmail(); }