diff --git a/composer.json b/composer.json index 31472d6..d8a6cd5 100644 --- a/composer.json +++ b/composer.json @@ -23,10 +23,10 @@ "require-dev": { "phpunit/phpunit": "~5.7", "satooshi/php-coveralls": "^1.0", - "swiftmailer/swiftmailer": "~5.4" + "swiftmailer/swiftmailer": "~5.4 || ^6.0" }, "suggest": { - "swiftmailer/swiftmailer": "Required to send the output of a job to email address/es (~5.4)." + "swiftmailer/swiftmailer": "Required to send the output of a job to email address/es (~5.4 || ^6.0)." }, "autoload": { "psr-4": { diff --git a/src/GO/Traits/Mailer.php b/src/GO/Traits/Mailer.php index 7678576..f42c787 100644 --- a/src/GO/Traits/Mailer.php +++ b/src/GO/Traits/Mailer.php @@ -29,7 +29,7 @@ public function getEmailConfig() if (! isset($this->emailConfig['transport']) || ! ($this->emailConfig['transport'] instanceof \Swift_Transport) ) { - $this->emailConfig['transport'] = \Swift_MailTransport::newInstance(); + $this->emailConfig['transport'] = new \Swift_SendmailTransport(); } return $this->emailConfig; @@ -43,13 +43,11 @@ public function getEmailConfig() */ private function sendToEmails(array $files) { - $mailer = \Swift_Mailer::newInstance( - $this->emailConfig['transport'] - ); + $mailer = new \Swift_Mailer($this->emailConfig['transport']); $config = $this->getEmailConfig(); - $message = \Swift_Message::newInstance() + $message = (new \Swift_Message()) ->setSubject($config['subject']) ->setFrom($config['from']) ->setTo($this->emailTo)