Comma-separated list of To-Emails breaks TYPO3Mailer
|Priority:||Should have||Due date:|
|Assignee:||Reinhard Führicht||% Done:||
With Mailer_TYPO3Mailer, I get an error message when trying to send Emails to a comma-separated list of recipients:
Address in mailbox given [firstname.lastname@example.org,email@example.com] does not comply with RFC 2822, 3.6.2.
Referring to the PHPdoc comment of the send() method in class Tx_Formhandler_Mailer_TYPO3Mailer, multiple recipients have to be passed as an array. But Tx_Formhandler_Finisher_Mail calls this method with the argument "implode(',', $recipients)", so there is always a string passed. Exploding this string again in Tx_Formhandler_Mailer_TYPO3Mailer makes it work for me.
I also stumbled upon a condition in Tx_Formhandler_Finisher_Mail which always evaluates to false because the comparison string is not defined. It also might be a comma-separated list instead of an array.
Please see the attached patch for a fix working for me.
Btw., the TS property to_name does not seem to be fully implemented as only the value of to_email gets passed to the send() method... but I did no fruther investigation here as it might require a much more complex patch.
Changes in MailerInterface and both mailers to fix a bug when using multiple recipients (fixes #38153)
Updated by Reinhard Führicht 11 months ago
- Category set to Finisher
- Status changed from New to Accepted
- Assignee set to Reinhard Führicht
- Target version set to v1.4
You are right, the code doesn't seem right there.
I tend to changing the interface to only allow an array to be passed to the "send" method each entry containing email and name pairs.
This should work pretty well for the TYPO3Mailer, but would need some adjustments for HtmlMail.
I will investigate this further.
Updated by Reinhard Führicht 10 months ago
- File 38153.patch added
- Status changed from Accepted to Needs Feedback
Please see attached patch. It changes the mailer interface to accept arrays only (not a strict check though).
Mailer_HtmlMail is changed accordingly.
Furthermore, I added a check if the count of recipients is bigger than zero before calling the mailer.