Skip to content

Commit 992d7b0

Browse files
authored
Swiftmailer 6.0 compatibility (#21)
* Clean up * Updated phpunit * Refactoring for v2 * Refectory for v2 pt2 * Required dev php7 Phpunit v6 requires php7 to run * Fancy helpers * Prioritise jobs in background * Use temp arrays to prioritise jobs * Coveralls * Coverall config * Adjusted waiting time on test * Typo fix * Removed deprecated flag * Added Coverage badge to readme * Removed psr/log suggestion * Fixed typo in composer.json * Fixes from styleci * Downgraded phpunit Using an older version of phpunit to allow testing on php5, as phpunit v6 requires php7 * Added php 7.1 supported version * More fixes from styleci * Fixes from styleci * Reordered badges + styleci badge * Increased tests waiting time when testing file output * Typo in the documentation Ref #16 * Fix #20 Added support for SwiftMailer ^6.0 ::newInstance() method has been deprecated, along with Swift_MailTransport. The default mail transport is now sendmail when using swiftmailer https://legalhackers.com/advisories/SwiftMailer-Exploit-Remote-Code-Exec -CVE-2016-10074-Vuln.html
1 parent ede01ff commit 992d7b0

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

composer.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@
2323
"require-dev": {
2424
"phpunit/phpunit": "~5.7",
2525
"satooshi/php-coveralls": "^1.0",
26-
"swiftmailer/swiftmailer": "~5.4"
26+
"swiftmailer/swiftmailer": "~5.4 || ^6.0"
2727
},
2828
"suggest": {
29-
"swiftmailer/swiftmailer": "Required to send the output of a job to email address/es (~5.4)."
29+
"swiftmailer/swiftmailer": "Required to send the output of a job to email address/es (~5.4 || ^6.0)."
3030
},
3131
"autoload": {
3232
"psr-4": {

src/GO/Traits/Mailer.php

+3-5
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public function getEmailConfig()
2929
if (! isset($this->emailConfig['transport']) ||
3030
! ($this->emailConfig['transport'] instanceof \Swift_Transport)
3131
) {
32-
$this->emailConfig['transport'] = \Swift_MailTransport::newInstance();
32+
$this->emailConfig['transport'] = new \Swift_SendmailTransport();
3333
}
3434

3535
return $this->emailConfig;
@@ -43,13 +43,11 @@ public function getEmailConfig()
4343
*/
4444
private function sendToEmails(array $files)
4545
{
46-
$mailer = \Swift_Mailer::newInstance(
47-
$this->emailConfig['transport']
48-
);
46+
$mailer = new \Swift_Mailer($this->emailConfig['transport']);
4947

5048
$config = $this->getEmailConfig();
5149

52-
$message = \Swift_Message::newInstance()
50+
$message = (new \Swift_Message())
5351
->setSubject($config['subject'])
5452
->setFrom($config['from'])
5553
->setTo($this->emailTo)

0 commit comments

Comments
 (0)