php-script causes error "Address in mailbox given [@localhost]"
I use in my system Typo3 a PHP script that maps a date management.
The sript enters events on the FE into a database and can change the registration.
In the script there is no mail delivery, so the error:
Address given in mailbox [@ localhost] does not comply with RFC 2822, 3.6.2.
can be brought to me with the script is not directly related
sorry for my bad english ...
(issue imported from #M17909)
#4 Updated by Joris Willems almost 7 years ago
I am getting the same error when running the direct mail cron from the command line. The mailing is send and than the error is thrown. I guess this is because it is trying sending a confirmation that the mailing has begun, I am not receiving that email. The lockfile is not removed so the mailing is stalled until manual intervention.
PHP Fatal error: Uncaught exception 'Swift_RfcComplianceException' with message 'Address in mailbox given [@localhost] does not comply with RFC 2822, 3.6.2.' in /home/***/typo3_src-4.5.3/typo3/contrib/swiftmailer/classes/Swift/Mime/Headers/MailboxHeader.php:309
#0 /home/***/typo3_src-4.5.3/typo3/contrib/swiftmailer/classes/Swift/Mime/Headers/MailboxHeader.php(239): Swift_Mime_Headers_MailboxHeader->_assertValidAddress('@localhost')
#1 /home/***/typo3_src-4.5.3/typo3/contrib/swiftmailer/classes/Swift/Mime/Headers/MailboxHeader.php(97): Swift_Mime_Headers_MailboxHeader->normalizeMailboxes(Array)
#2 /home/***/typo3_src-4.5.3/typo3/contrib/swiftmailer/classes/Swift/Mime/Headers/MailboxHeader.php(61): Swift_Mime_Headers_MailboxHeader->setNameAddresses(Array)
#3 /home/***/typo3_src-4.5.3/typo3/contrib/swiftmailer/classes/Swift/Mime/SimpleHeaderFactory.php(64): Swift_Mime_Headers_MailboxHeader->setFieldBodyModel(Array)
#4 /home/***/typo3_src-4.5.3/typo3/contrib in /home/***/typo3_src-4.5.3/typo3/contrib/swiftmailer/classes/Swift/Mime/Headers/MailboxHeader.php on line 309
I'm considering $TYPO3_CONF_VARS['MAIL']['substituteOldMailAPI'] = 0 (EDIT: solved the issue for now)
#6 Updated by Joris Willems almost 7 years ago
I found out that setting the replyto email and name in the Direct Mail > Configuration module solves the issue.
$headers = 'Reply-To: '.$this->replyto_email;
If it is not set it passes an empty header:
replyto does not have a safe fall-back when leaving it empty.
EDIT: The code is in ext/direct_mail/res/scripts/class.dmailer.php starting line 672