48 $this->mailer->send($this->
buildMessage($content, $records));
72 if ($this->messageTemplate instanceof \Swift_Message) {
75 } elseif (is_callable($this->messageTemplate)) {
76 $message = call_user_func($this->messageTemplate, $content, $records);
79 if (!
$message instanceof \Swift_Message) {
80 throw new \InvalidArgumentException(
'Could not resolve message as instance of Swift_Message or a callable returning it');
85 $message->setSubject($subjectFormatter->format($this->getHighestRecord($records)));
89 if (version_compare(Swift::VERSION,
'6.0.0',
'>=')) {
103 if (
$name ===
'message') {
104 trigger_error(
'SwiftMailerHandler->message is deprecated, use ->buildMessage() instead to retrieve the message', E_USER_DEPRECATED);
109 throw new \InvalidArgumentException(
'Invalid property '.
$name);
const ERROR
Runtime errors.
__get($name)
BC getter, to be removed in 2.0.
catch(Exception $e) $message
__construct(\Swift_Mailer $mailer, $message, $level=Logger::ERROR, $bubble=true)
send($content, array $records)
{}
buildMessage($content, array $records)
Creates instance of Swift_Message to be sent.
Base class for all mail handlers.
getSubjectFormatter($format)
Gets the formatter for the Swift_Message subject.
SwiftMailerHandler uses Swift_Mailer to send the emails.