72 if ($this->messageTemplate instanceof \Swift_Message) {
75 } elseif (is_callable($this->messageTemplate)) {
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',
'>=')) {
90 $message->setDate(
new \DateTimeImmutable());
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);
An exception for terminatinating execution or to throw for unit testing.
Base class for all mail handlers.
SwiftMailerHandler uses Swift_Mailer to send the emails.
send($content, array $records)
{Send a mail with the given content.}
__construct(\Swift_Mailer $mailer, $message, $level=Logger::ERROR, $bubble=true)
__get($name)
BC getter, to be removed in 2.0.
buildMessage($content, array $records)
Creates instance of Swift_Message to be sent.
getSubjectFormatter($format)
Gets the formatter for the Swift_Message subject.
const ERROR
Runtime errors.
catch(Exception $e) $message