Bug #25295

php-script causes error "Address in mailbox given [@localhost]"

Added by Tobias Leichsenring about 7 years ago. Updated about 6 years ago.

Should have
Target version:
Start date:
Due date:
% Done:


TYPO3 Version:
PHP Version:
Is Regression:
Sprint Focus:


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)

Related issues

Related to Direct Mail - Bug #27633: empty header passed to swift when reply-to is empty Closed 2011-06-22


#1 Updated by Philipp Gampe about 7 years ago

You try to send an email or your code triggers it somehow. But you use a not existing email address (localhost). You should make sure that you specify a correct TO and a correct FROM (!) address.

#2 Updated by Steffen Gebert almost 7 years ago

  • Status changed from New to Needs Feedback
  • Target version deleted (0)

Tobias, can you give feedback on this?

There has been a bug with the mail API, which IIRC resulted in this error message and is fixed in 4.5.1 or 4.5.2. Are you using 4.5.2?


#3 Updated by Andrey Aksenov almost 7 years ago

Yes, I use a version of TYPO3 4.5.2 and get the same error.

#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
Stack trace:
#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)

#5 Updated by Steffen Gebert almost 7 years ago

Could you look up, how direct_mail calls the mail API? Maybe it does sth. wrong (or the new SwiftMailer API has a limitation).

#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

#7 Updated by Joris Willems almost 7 years ago

I filed a new bug #27633

#8 Updated by Stefan Galinski about 6 years ago

  • Status changed from Needs Feedback to Closed

Also available in: Atom PDF