Logging, mail and errors · Question 1 of 12
How is a MailMessage sent in TYPO3 v14?
1 answer is correct. Easy
Show answer
Answer
- D Through a MailerInterface injected via dependency injection, with $this->mailer->send($mail)
Explanation
In TYPO3 v14 MailMessage is a pure data object: you set sender, recipient, subject and text, for example with ->from(), ->to(), ->subject() and ->text(). Sending is done by the service TYPO3\, which you have injected via the constructor. The formerly common method $mail->send() was removed in v14, so old code fails with an error at this point. The mailer automatically uses the transport configured in $GLOBALS['TYPO3_CONF_VARS']['MAIL'].