diff --git a/src/Email/SwiftMailer.php b/src/Email/SwiftMailer.php index 8bb4013..6dee0fa 100644 --- a/src/Email/SwiftMailer.php +++ b/src/Email/SwiftMailer.php @@ -12,6 +12,8 @@ class SwiftMailer implements MailerInterface protected $to; + protected $cc; + public function __construct(EmailConfiguration $configuration) { $this->emailConfiguration = $configuration; @@ -25,20 +27,30 @@ class SwiftMailer implements MailerInterface $swiftObj = ( new \Swift_Message($subject) ) ->setFrom( $this->from ) ->setTo( $this->to ) + ->setCC($this->cc ?? []) ->setBody( $message, $html ? 'text/html' : 'text/plain' ); return ( new \Swift_Mailer($this->transport) )->send($swiftObj); } - public function setFrom($from) : MailerInterface + public function setFrom(/*stringable|array*/ $from) : MailerInterface { $this->from = $from; + return $this; } - public function setTo($to) : MailerInterface + public function setTo(/*stringable|array*/ $to) : MailerInterface { $this->to = $to; + + return $this; + } + + public function setCC(/*stringable|array*/ $cc) : MailerInterface + { + $this->cc = $cc; + return $this; }