1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-10-22 17:16:18 +02:00

Fix SwiftMailerHandler support for Swiftmailer 6.0+

This commit is contained in:
Alex Rock Ancelet
2017-05-31 21:40:53 +02:00
committed by Jordi Boggiano
parent 6fdf686a02
commit d84af8db3c
3 changed files with 8 additions and 3 deletions

View File

@@ -13,6 +13,7 @@ namespace Monolog\Handler;
use Monolog\Logger;
use Monolog\Formatter\LineFormatter;
use Swift;
/**
* SwiftMailerHandler uses Swift_Mailer to send the emails
@@ -73,7 +74,11 @@ class SwiftMailerHandler extends MailHandler
}
$message->setBody($content);
$message->setDate(time());
if (version_compare(Swift::VERSION, '6.0.0', '>=')) {
$message->setDate(new \DateTimeImmutable());
} else {
$message->setDate(time());
}
return $message;
}