mirror of
https://github.com/Seldaek/monolog.git
synced 2025-10-21 16:46:11 +02:00
Refactored the MailHandler to use the formatter to format the batch message
This commit is contained in:
@@ -15,28 +15,25 @@ use Monolog\Logger;
|
||||
|
||||
/**
|
||||
* SwiftMailerHandler uses Swift_Mailer to send the emails
|
||||
*
|
||||
*
|
||||
* @author Gyula Sallai
|
||||
*/
|
||||
class SwiftMailerHandler extends MailHandler
|
||||
{
|
||||
|
||||
protected $mailer;
|
||||
protected $message;
|
||||
|
||||
|
||||
/**
|
||||
* @param \Swift_Mailer $mailer The mailer to use
|
||||
* @param \Swift_Message $message An example message for real messages,
|
||||
* only the body will be replaced
|
||||
* @param \Swift_Message $message An example message for real messages, only the body will be replaced
|
||||
* @param integer $level The minimum logging level at which this handler will be triggered
|
||||
* @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not
|
||||
*/
|
||||
public function __construct(\Swift_Mailer $mailer, \Swift_Message $message, $level = Logger::ERROR, $bubble = false)
|
||||
{
|
||||
parent::__construct($level, $bubble);
|
||||
$this->mailer = $mailer;
|
||||
$this->message = $message;
|
||||
$this->level = $level;
|
||||
$this->bubble = $bubble;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -46,8 +43,7 @@ class SwiftMailerHandler extends MailHandler
|
||||
{
|
||||
$message = clone $this->message;
|
||||
$message->setBody($content);
|
||||
|
||||
|
||||
$this->mailer->send($message);
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user