Fix incompatibilities with new version of Swiftmailer

[MAILPOET-2589]
This commit is contained in:
Jan Jakeš
2020-01-29 11:45:01 +01:00
committed by Jack Kitterhing
parent aeac8c664d
commit 43873306cd
2 changed files with 4 additions and 5 deletions

View File

@@ -109,7 +109,7 @@ class AmazonSES {
} }
public function createMessage($newsletter, $subscriber, $extraParams = []) { public function createMessage($newsletter, $subscriber, $extraParams = []) {
$message = Swift_Message::newInstance() $message = (new Swift_Message())
->setTo($this->processSubscriber($subscriber)) ->setTo($this->processSubscriber($subscriber))
->setFrom([ ->setFrom([
$this->sender['from_email'] => $this->sender['from_name'], $this->sender['from_email'] => $this->sender['from_name'],

View File

@@ -78,8 +78,7 @@ class SMTP {
} }
public function buildMailer() { public function buildMailer() {
$transport = Swift_SmtpTransport::newInstance( $transport = new Swift_SmtpTransport($this->host, $this->port, $this->encryption);
$this->host, $this->port, $this->encryption);
$connectionTimeout = $this->wp->applyFilters('mailpoet_mailer_smtp_connection_timeout', self::SMTP_CONNECTION_TIMEOUT); $connectionTimeout = $this->wp->applyFilters('mailpoet_mailer_smtp_connection_timeout', self::SMTP_CONNECTION_TIMEOUT);
$transport->setTimeout($connectionTimeout); $transport->setTimeout($connectionTimeout);
if ($this->authentication) { if ($this->authentication) {
@@ -88,11 +87,11 @@ class SMTP {
->setPassword($this->password); ->setPassword($this->password);
} }
$transport = $this->wp->applyFilters('mailpoet_mailer_smtp_transport_agent', $transport); $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 = []) { public function createMessage($newsletter, $subscriber, $extraParams = []) {
$message = Swift_Message::newInstance() $message = (new Swift_Message())
->setTo($this->processSubscriber($subscriber)) ->setTo($this->processSubscriber($subscriber))
->setFrom( ->setFrom(
[ [