Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Emails failing with testToEmailAddress enabled #4076

Closed
lindseydiloreto opened this issue Mar 29, 2019 · 2 comments
Closed

Emails failing with testToEmailAddress enabled #4076

lindseydiloreto opened this issue Mar 29, 2019 · 2 comments

Comments

@lindseydiloreto
Copy link
Contributor

Description

When testToEmailAddress is enabled, emails are not being sent. It looks like this line is causing the mailer to crash...

https://github.com/craftcms/cms/blob/develop/src/mail/Mailer.php#L163-L164

Apparently, it's trying to validate null as an email address.

I've tested this in two places, with identical results...

  • Settings > Email > "Test"
  • Forgot your password? > Reset Password

Steps to reproduce

  1. Send a test email.
  2. Observe error:
Address in mailbox given [] does not comply with RFC 2822

Full stack trace...

2019-03-29 14:01:31 [-][1][8anuiuj7iil8674hvbastnb2n8][profile end][craft\web\twig\Template::display] __string_template__e5ae62ef6ea2f82459f0730d5b0d05460bbf9464958f744c667d596116b800ef
2019-03-29 14:01:31 [-][1][8anuiuj7iil8674hvbastnb2n8][trace][craft\web\View::renderTemplate] Rendering template: _special/email
2019-03-29 14:01:31 [-][1][8anuiuj7iil8674hvbastnb2n8][profile begin][craft\web\View::renderTemplate] _special/email
2019-03-29 14:01:31 [-][1][8anuiuj7iil8674hvbastnb2n8][profile begin][craft\web\twig\Template::display] _special/email
2019-03-29 14:01:31 [-][1][8anuiuj7iil8674hvbastnb2n8][profile end][craft\web\twig\Template::display] _special/email
2019-03-29 14:01:31 [-][1][8anuiuj7iil8674hvbastnb2n8][profile end][craft\web\View::renderTemplate] _special/email
2019-03-29 14:01:31 [-][1][8anuiuj7iil8674hvbastnb2n8][error][Swift_RfcComplianceException] Swift_RfcComplianceException: Address in mailbox given [] does not comply with RFC 2822, 3.6.2. in /../vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Headers/MailboxHeader.php:355
Stack trace:
#0 /../vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Headers/MailboxHeader.php(272): Swift_Mime_Headers_MailboxHeader->assertValidAddress(NULL)
#1 /../vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Headers/MailboxHeader.php(117): Swift_Mime_Headers_MailboxHeader->normalizeMailboxes(Array)
#2 /../vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Headers/MailboxHeader.php(74): Swift_Mime_Headers_MailboxHeader->setNameAddresses(Array)
#3 /../vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/SimpleHeaderFactory.php(61): Swift_Mime_Headers_MailboxHeader->setFieldBodyModel(Array)
#4 /../vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/SimpleHeaderSet.php(71): Swift_Mime_SimpleHeaderFactory->createMailboxHeader('Cc', Array)
#5 /../vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/SimpleMessage.php(375): Swift_Mime_SimpleHeaderSet->addMailboxHeader('Cc', Array)
#6 /../vendor/yiisoft/yii2-swiftmailer/src/Message.php(157): Swift_Mime_SimpleMessage->setCc(Array)
#7 /../vendor/craftcms/cms/src/mail/Message.php(95): yii\swiftmailer\Message->setCc(Array)
#8 /../vendor/craftcms/cms/src/mail/Mailer.php(163): craft\mail\Message->setCc(Array)
#9 /../vendor/yiisoft/yii2/mail/BaseMessage.php(49): craft\mail\Mailer->send(Object(craft\mail\Message))
#10 /../vendor/craftcms/cms/src/controllers/SystemSettingsController.php(271): yii\mail\BaseMessage->send()
#11 [internal function]: craft\controllers\SystemSettingsController->actionTestEmailSettings()
#12 /../vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#13 /../vendor/yiisoft/yii2/base/Controller.php(157): yii\base\InlineAction->runWithParams(Array)
#14 /../vendor/craftcms/cms/src/web/Controller.php(109): yii\base\Controller->runAction('test-email-sett...', Array)
#15 /../vendor/yiisoft/yii2/base/Module.php(528): craft\web\Controller->runAction('test-email-sett...', Array)
#16 /../vendor/craftcms/cms/src/web/Application.php(297): yii\base\Module->runAction('system-settings...', Array)
#17 /../vendor/craftcms/cms/src/web/Application.php(561): craft\web\Application->runAction('system-settings...', Array)
#18 /../vendor/craftcms/cms/src/web/Application.php(281): craft\web\Application->_processActionRequest(Object(craft\web\Request))
#19 /../vendor/yiisoft/yii2/base/Application.php(386): craft\web\Application->handleRequest(Object(craft\web\Request))
#20 /../public/index.php(31): yii\base\Application->run()
#21 /Users/lindseydiloreto/.composer/vendor/laravel/valet/server.php(158): require('/Users/lindseyd...')
#22 {main}

Additional info

  • Craft version: Craft Solo 3.1.20.1
  • PHP version: 7.1.26
  • Database driver & version: MySQL 5.5.5
  • Plugins & versions: Nothing mail related
@brandonkelly
Copy link
Member

Fixed for the next release, thanks for reporting!

To get the fix early, change your craftcms/cms requirement in composer.json to:

"require": {
  "craftcms/cms": "dev-develop#61c9903e1d0d5758c7b2aef351c61b6401813373 as 3.1.20.1",
  "...": "..."
}

Then run composer update.

@lindseydiloreto
Copy link
Contributor Author

Awesome, thanks @brandonkelly! 🍺

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants