From 9c1ef4e1bb21e16cb165e3716c780b5c7733cec6 Mon Sep 17 00:00:00 2001 From: "Thomas A. Hirsch" Date: Wed, 9 Sep 2020 21:21:10 +0200 Subject: [PATCH 1/3] Changes to allow Swiftmailer 5 and 6. --- composer.json | 2 +- lib/mailer/sfMailer.class.php | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/composer.json b/composer.json index 8e3a7c61b..150e446cb 100755 --- a/composer.json +++ b/composer.json @@ -5,7 +5,7 @@ "license": "MIT", "require": { "php" : ">=5.3.0", - "swiftmailer/swiftmailer": "~5.2" + "swiftmailer/swiftmailer": "~5.2|^6.0" }, "require-dev": { "psr/log": "*" diff --git a/lib/mailer/sfMailer.class.php b/lib/mailer/sfMailer.class.php index ee9ce93e8..fc545ff86 100755 --- a/lib/mailer/sfMailer.class.php +++ b/lib/mailer/sfMailer.class.php @@ -239,7 +239,8 @@ public function setDeliveryAddress($address) */ public function compose($from = null, $to = null, $subject = null, $body = null) { - return Swift_Message::newInstance() + $msg = new Swift_Message(); + return $msg ->setFrom($from) ->setTo($to) ->setSubject($subject) @@ -282,7 +283,7 @@ public function sendNextImmediately() * * @return int|false The number of sent emails */ - public function send(Swift_Mime_Message $message, &$failedRecipients = null) + public function send($message, &$failedRecipients = null) { if ($this->force) { From 1c64cbdfd98f76f0bb1d87ee5736643a32f6f627 Mon Sep 17 00:00:00 2001 From: "Thomas A. Hirsch" Date: Thu, 10 Sep 2020 07:42:18 +0200 Subject: [PATCH 2/3] PR feedback. --- lib/mailer/sfMailer.class.php | 5 +++-- lib/mailer/sfNoMailer.class.php | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/mailer/sfMailer.class.php b/lib/mailer/sfMailer.class.php index fc545ff86..86afba3e3 100755 --- a/lib/mailer/sfMailer.class.php +++ b/lib/mailer/sfMailer.class.php @@ -240,6 +240,7 @@ public function setDeliveryAddress($address) public function compose($from = null, $to = null, $subject = null, $body = null) { $msg = new Swift_Message(); + return $msg ->setFrom($from) ->setTo($to) @@ -278,8 +279,8 @@ public function sendNextImmediately() /** * Sends the given message. * - * @param Swift_Transport $transport A transport instance - * @param string[] &$failedRecipients An array of failures by-reference + * @param Swift_Mime_Message|Swift_Mime_SimpleMessage $message The message to send. + * @param string[] &$failedRecipients An array of failures by-reference * * @return int|false The number of sent emails */ diff --git a/lib/mailer/sfNoMailer.class.php b/lib/mailer/sfNoMailer.class.php index 83324e9a0..507b61a33 100644 --- a/lib/mailer/sfNoMailer.class.php +++ b/lib/mailer/sfNoMailer.class.php @@ -56,7 +56,7 @@ public function sendNextImmediately() return null; } - public function send(Swift_Mime_Message $message, &$failedRecipients = null) + public function send($message, &$failedRecipients = null) { return null; } From 8ae3232c51e309e1244a76c6559f92623894a007 Mon Sep 17 00:00:00 2001 From: "Thomas A. Hirsch" Date: Tue, 23 Mar 2021 18:00:40 +0100 Subject: [PATCH 3/3] PR feedback. --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 150e446cb..d5bc7d931 100755 --- a/composer.json +++ b/composer.json @@ -5,7 +5,7 @@ "license": "MIT", "require": { "php" : ">=5.3.0", - "swiftmailer/swiftmailer": "~5.2|^6.0" + "swiftmailer/swiftmailer": "~5.2 || ^6.0" }, "require-dev": { "psr/log": "*"