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

Add ability to use formatter in email subject lines

This commit is contained in:
Jordi Boggiano
2016-04-12 18:05:41 +01:00
parent 1fa91efc3b
commit a754edc64c
5 changed files with 63 additions and 1 deletions

View File

@@ -12,6 +12,7 @@
namespace Monolog\Handler;
use Monolog\Logger;
use Monolog\Formatter\LineFormatter;
/**
* SwiftMailerHandler uses Swift_Mailer to send the emails
@@ -66,6 +67,11 @@ class SwiftMailerHandler extends MailHandler
throw new \InvalidArgumentException('Could not resolve message as instance of Swift_Message or a callable returning it');
}
if ($records) {
$subjectFormatter = new LineFormatter($message->getSubject());
$message->setSubject($subjectFormatter->format($this->getHighestRecord($records)));
}
$message->setBody($content);
$message->setDate(time());