- Work on SwiftMailer interface

This commit is contained in:
Dave M. 2021-01-06 19:32:56 +00:00
parent 689c3203e7
commit bee7e25935
1 changed files with 12 additions and 3 deletions

View File

@ -8,11 +8,13 @@ class SwiftMailer implements MailerInterface
protected $transport;
protected $from;
protected /*stringable*/ $from;
protected $to;
protected /*stringable|array*/ $to;
protected $cc;
protected /*stringable|array*/ $cc;
protected /*stringable|array*/ $bcc;
public function __construct(EmailConfiguration $configuration) {
$this->emailConfiguration = $configuration;
@ -28,6 +30,7 @@ class SwiftMailer implements MailerInterface
->setFrom( $this->from )
->setTo( $this->to )
->setCC($this->cc ?? [])
->setBCC($this->bcc ?? [])
->setBody( $message, $html ? 'text/html' : 'text/plain' );
return ( new \Swift_Mailer($this->transport) )->send($swiftObj);
@ -54,4 +57,10 @@ class SwiftMailer implements MailerInterface
return $this;
}
public function setBCC(/*stringable|array*/ $bcc) : MailerInterface
{
$this->bcc = $bcc;
return $this;
}
}