diff --git a/lib/Mailer/Methods/AmazonSES.php b/lib/Mailer/Methods/AmazonSES.php index f758d85745..e85f7ee9c5 100644 --- a/lib/Mailer/Methods/AmazonSES.php +++ b/lib/Mailer/Methods/AmazonSES.php @@ -109,7 +109,7 @@ class AmazonSES { } public function createMessage($newsletter, $subscriber, $extraParams = []) { - $message = Swift_Message::newInstance() + $message = (new Swift_Message()) ->setTo($this->processSubscriber($subscriber)) ->setFrom([ $this->sender['from_email'] => $this->sender['from_name'], diff --git a/lib/Mailer/Methods/SMTP.php b/lib/Mailer/Methods/SMTP.php index c4f3a5dc98..babe7af81e 100644 --- a/lib/Mailer/Methods/SMTP.php +++ b/lib/Mailer/Methods/SMTP.php @@ -78,8 +78,7 @@ class SMTP { } public function buildMailer() { - $transport = Swift_SmtpTransport::newInstance( - $this->host, $this->port, $this->encryption); + $transport = new Swift_SmtpTransport($this->host, $this->port, $this->encryption); $connectionTimeout = $this->wp->applyFilters('mailpoet_mailer_smtp_connection_timeout', self::SMTP_CONNECTION_TIMEOUT); $transport->setTimeout($connectionTimeout); if ($this->authentication) { @@ -88,11 +87,11 @@ class SMTP { ->setPassword($this->password); } $transport = $this->wp->applyFilters('mailpoet_mailer_smtp_transport_agent', $transport); - return Swift_Mailer::newInstance($transport); + return new Swift_Mailer($transport); } public function createMessage($newsletter, $subscriber, $extraParams = []) { - $message = Swift_Message::newInstance() + $message = (new Swift_Message()) ->setTo($this->processSubscriber($subscriber)) ->setFrom( [