Issue Bug Closed

#89083MailMessage setFrom and setTo are throwing exceptions

Sebastian Fischer 09/04/19, 19:48 updated 12/23/19, 22:57

Description

Both setFrom and setTo are not working as documented.

$mail = $this->objectManager->get(\TYPO3\CMS\Core\Mail\MailMessage::class);

$mail->setFrom(‘test2@fischer.im’);
Exception -> An address can be an instance of Address or a string (“NULL”) given).

$mail->setFrom(‘test2@fischer.im’, ‘bbb’);
Exception -> Email “bbb” does not comply with addr-spec of RFC 2822.

$mail->setFrom([‘test2@fischer.im’ => ‘bbb’]);
Exception -> An address can be an instance of Address or a string (“array”) given).

$mail->setTo([‘test1@fischer.im’ => ‘aaa’]);
Exception -> An address can be an instance of Address or a string (“array”) given).

Reviews 1