From 4646a05c7a4e039a383ad37b180383d57a8a32da Mon Sep 17 00:00:00 2001 From: Pierre Goiffon Date: Tue, 3 May 2022 09:01:56 +0200 Subject: [PATCH] =?UTF-8?q?N=C2=B04824=20Update=20consumers=20after=20swif?= =?UTF-8?q?tmailer/swiftmailer?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Multiple things to do as there were some changes in 6.0 Reference : https://github.com/swiftmailer/swiftmailer/blob/master/CHANGES#L107 * Fix "Call to undefined method Swift_Message::newInstance()" exception in notifications * Fix removed Swift_MailTransport --- core/email.class.inc.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/core/email.class.inc.php b/core/email.class.inc.php index 36122e56f..c303bf029 100644 --- a/core/email.class.inc.php +++ b/core/email.class.inc.php @@ -58,7 +58,7 @@ class EMail public function __construct() { $this->m_aData = array(); - $this->m_oMessage = Swift_Message::newInstance(); + $this->m_oMessage = new Swift_Message(); $this->SetRecipientFrom(MetaModel::GetConfig()->Get('email_default_sender_address'), MetaModel::GetConfig()->Get('email_default_sender_label')); } @@ -172,7 +172,7 @@ class EMail $sUserName = self::$m_oConfig->Get('email_transport_smtp.username'); $sPassword = self::$m_oConfig->Get('email_transport_smtp.password'); - $oTransport = Swift_SmtpTransport::newInstance($sHost, $sPort, $sEncryption); + $oTransport = new Swift_SmtpTransport($sHost, $sPort, $sEncryption); if (strlen($sUserName) > 0) { $oTransport->setUsername($sUserName); @@ -181,20 +181,20 @@ class EMail break; case 'Null': - $oTransport = Swift_NullTransport::newInstance(); + $oTransport = new Swift_NullTransport(); break; case 'LogFile': - $oTransport = Swift_LogFileTransport::newInstance(); + $oTransport = new Swift_LogFileTransport(); $oTransport->setLogFile(APPROOT.'log/mail.log'); break; case 'PHPMail': default: - $oTransport = Swift_MailTransport::newInstance(); + $oTransport = new Swift_SendmailTransport(); } - $oMailer = Swift_Mailer::newInstance($oTransport); + $oMailer = new Swift_Mailer($oTransport); $aFailedRecipients = array(); $this->m_oMessage->setMaxLineLength(0); @@ -364,7 +364,7 @@ class EMail $this->m_aData['attachments'] = array(); } $this->m_aData['attachments'][] = array('data' => base64_encode($data), 'filename' => $sFileName, 'mimeType' => $sMimeType); - $this->m_oMessage->attach(Swift_Attachment::newInstance($data, $sFileName, $sMimeType)); + $this->m_oMessage->attach(new Swift_Attachment($data, $sFileName, $sMimeType)); } public function SetSubject($sSubject)