Bug #48247

forgot password email submission in felogin triggers swiftmailer "does not comply with RFC 2822" error

Added by Alban Cousinie over 4 years ago. Updated over 4 years ago.

Status:
Resolved
Priority:
Must have
Assignee:
Category:
-
Target version:
-
Start date:
2013-05-16
Due date:
% Done:

100%

TYPO3 Version:
6.1
PHP Version:
5.4
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

When using the password reinitialization feature of system extension felogin, the user submits his email address.
The submission of the form raises the following error :

Address in mailbox given [@localhost] does not comply with RFC 2822, 3.6.2.

This seems to relate somewhat to issue 42106 (http://forge.typo3.org/issues/42106) although this one is fixed on my Typo3 6.1 installation. But again the error seems to be raised by the setting of the reply-to header (see step 14 in stack trace below)

Here is the stack trace :

Swift_RfcComplianceException thrown in file
/var/www/clients/client44/web178/web/typo3_src-6.1.0/typo3/contrib/swiftmailer/classes/Swift/Mime/Headers/MailboxHeader.php in line 352.

18 Swift_Mime_Headers_MailboxHeader::_assertValidAddress("@localhost")

/var/www/clients/client44/web178/web/typo3_src-6.1.0/typo3/contrib/swiftmailer/classes/Swift/Mime/Headers/MailboxHeader.php:
00262:                 $name = null;
00263:             }
00264:             $this->_assertValidAddress($address);
00265:             $actualMailboxes[$address] = $name;
00266:         }

17 Swift_Mime_Headers_MailboxHeader::normalizeMailboxes(array)

/var/www/clients/client44/web178/web/typo3_src-6.1.0/typo3/contrib/swiftmailer/classes/Swift/Mime/Headers/MailboxHeader.php:
00106:     public function setNameAddresses($mailboxes)
00107:     {
00108:         $this->_mailboxes = $this->normalizeMailboxes((array) $mailboxes);
00109:         $this->setCachedValue(null); //Clear any cached value
00110:     }

16 Swift_Mime_Headers_MailboxHeader::setNameAddresses(array)

/var/www/clients/client44/web178/web/typo3_src-6.1.0/typo3/contrib/swiftmailer/classes/Swift/Mime/Headers/MailboxHeader.php:
00063:     public function setFieldBodyModel($model)
00064:     {
00065:         $this->setNameAddresses($model);
00066:     }
00067: 

15 Swift_Mime_Headers_MailboxHeader::setFieldBodyModel(array)

/var/www/clients/client44/web178/web/typo3_src-6.1.0/typo3/contrib/swiftmailer/classes/Swift/Mime/SimpleHeaderFactory.php:
00058:         $header = new Swift_Mime_Headers_MailboxHeader($name, $this->_encoder, $this->_grammar);
00059:         if (isset($addresses)) {
00060:             $header->setFieldBodyModel($addresses);
00061:         }
00062:         $this->_setHeaderCharset($header);

14 Swift_Mime_SimpleHeaderFactory::createMailboxHeader("Reply-To", array)

/var/www/clients/client44/web178/web/typo3_src-6.1.0/typo3/contrib/swiftmailer/classes/Swift/Mime/SimpleHeaderSet.php:
00068:     {
00069:         $this->_storeHeader($name,
00070:         $this->_factory->createMailboxHeader($name, $addresses));
00071:     }
00072: 

13 Swift_Mime_SimpleHeaderSet::addMailboxHeader("Reply-To", array)

/var/www/clients/client44/web178/web/typo3_src-6.1.0/typo3/contrib/swiftmailer/classes/Swift/Mime/SimpleMessage.php:
00268: 
00269:         if (!$this->_setHeaderFieldModel('Reply-To', (array) $addresses)) {
00270:             $this->getHeaders()->addMailboxHeader('Reply-To', (array) $addresses);
00271:         }
00272: 

12 Swift_Mime_SimpleMessage::setReplyTo(array)

/var/www/clients/client44/web178/web/typo3_src-6.1.0/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php:
06612:   $parsedReplyTo = \TYPO3\CMS\Core\Utility\MailUtility::parseAddresses($replyTo);
06613:   if (count($parsedReplyTo) > 0) {
06614:    $mail->setReplyTo($parsedReplyTo);
06615:   }
06616:   $message = trim($message);

11 TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::sendNotifyEmail("Votre nouveau mot de passe↵Cher albanc↵,↵Cet email…a procédure de réinitialisation de mot de passe.", "alban@mind2machine.com", "", "", "", "")

/var/www/clients/client44/web178/web/typo3_src-6.1.0/typo3/sysext/felogin/Classes/Controller/FrontendLoginController.php:
00455:   $GLOBALS['TSFE']->config['config']['notification_email_urlmode'] = 0;
00456:   // Send the email
00457:   $this->cObj->sendNotifyEmail($msg, $user['email'], '', $this->conf['email_from'], $this->conf['email_fromName'], $this->conf['replyTo']);
00458:   // Restore settings
00459:   $GLOBALS['TSFE']->config['config']['notification_email_urlmode'] = $oldSetting;

10 TYPO3\CMS\Felogin\Controller\FrontendLoginController::generateAndSendHash(array)

/var/www/clients/client44/web178/web/typo3_src-6.1.0/typo3/sysext/felogin/Classes/Controller/FrontendLoginController.php:
00245:     if ($row) {
00246:      // Generate an email with the hashed link
00247:      $error = $this->generateAndSendHash($row);
00248:     } elseif ($this->conf['exposeNonexistentUserInForgotPasswordDialog']) {
00249:      $error = $this->pi_getLL('ll_forgot_reset_message_error');

9 TYPO3\CMS\Felogin\Controller\FrontendLoginController::showForgot()

/var/www/clients/client44/web178/web/typo3_src-6.1.0/typo3/sysext/felogin/Classes/Controller/FrontendLoginController.php:
00169:   $content = '';
00170:   if ($this->piVars['forgot']) {
00171:    $content .= $this->showForgot();
00172:   } elseif ($this->piVars['forgothash']) {
00173:    $content .= $this->changePassword();

8 TYPO3\CMS\Felogin\Controller\FrontendLoginController::main("", array)
7 call_user_func_array(array, array)

/var/www/clients/client44/web178/web/typo3_src-6.1.0/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php:
06436:       $content,
06437:       $conf
06438:      ));
06439:     } else {
06440:      $GLOBALS['TT']->setTSlogMessage('Method "' . $parts[1] . '" did not exist in class "' . $parts[0] . '"', 3);

6 TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::callUserFunction("tx_felogin_pi1->main", array, "")

/var/www/clients/client44/web178/web/typo3_src-6.1.0/typo3/sysext/frontend/Classes/ContentObject/UserContentObject.php:
00053:   }
00054:   $this->cObj->includeLibs($conf);
00055:   $tempContent = $this->cObj->callUserFunction($conf['userFunc'], $conf, '');
00056:   if ($this->cObj->doConvertToUserIntObject) {
00057:    $this->cObj->doConvertToUserIntObject = FALSE;

5 TYPO3\CMS\Frontend\ContentObject\UserContentObject::render(array)

/var/www/clients/client44/web178/web/typo3_src-6.1.0/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php:
00902:    return $this->getContentObject('USER_INT')->render($conf);
00903:   } else {
00904:    return $this->getContentObject('USER')->render($conf);
00905:   }
00906:  }

4 TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::USER(array)

/var/www/clients/client44/web178/web/typo3_src-6.1.0/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php:
03451:       break;
03452:      case 'FUNC':
03453:       $incContent = $INTiS_cObj->USER($INTiS_config[$INTiS_key]['conf']);
03454:       break;
03455:      case 'POSTUSERFUNC':

3 TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController::INTincScript_process(array)

/var/www/clients/client44/web178/web/typo3_src-6.1.0/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php:
03391:    $INTiS_config = $this->config['INTincScript'];
03392:    $this->INTincScript_includeLibs($INTiS_config);
03393:    $this->INTincScript_process($INTiS_config);
03394:    // Check if there were new items added to INTincScript during the previous execution:
03395:    $INTiS_config = array_diff_assoc($this->config['INTincScript'], $INTiS_config);

2 TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController::INTincScript()

/var/www/clients/client44/web178/web/typo3_src-6.1.0/typo3/sysext/cms/tslib/index_ts.php:
00202: if ($TSFE->isINTincScript()) {
00203:  $TT->push('Non-cached objects', '');
00204:  $TSFE->INTincScript();
00205:  $TT->pull();
00206: }

1 require("/var/www/clients/client44/web178/web/typo3_src-6.1.0/typo3/sysext/cms/tslib/index_ts.php")

/var/www/clients/client44/web178/web/typo3_src-6.1.0/index.php:
00039:  ->redirectToInstallToolIfLocalConfigurationFileDoesNotExist();
00040: 
00041: require(PATH_tslib . 'index_ts.php');
00042: ?>

Associated revisions

Revision 3ecec354 (diff)
Added by Philipp Gampe over 4 years ago

[BUGFIX] MailUtility::parseAddresses() returns @localhost on empty string

parseAddresses should return an array of email addresses ready to be
feed into swiftmailer.
If an empty string is passed to the function, then it returns
"@localhost", which is not a valid email.
Swiftmailer will throw an exception "Address in mailbox given
[@localhost] does not comply with RFC 2822, 3.6.2."
This happens in ContentObjectRenderer->sendNotifyEmail() which is in
turn used by the frontend login forgotten passwort form.

Skip any addresses without a mailbox given.

Resolves: #48247
Releases: 6.2, 6.1
Change-Id: If8724416b3451417db7729dc81abdbd068dc8b10
Reviewed-on: https://review.typo3.org/20839
Tested-by: Philipp Gampe
Reviewed-by: Wouter Wolters
Tested-by: Wouter Wolters
Reviewed-by: Jigal van Hemert
Tested-by: Jigal van Hemert

Revision e3defb60 (diff)
Added by Philipp Gampe over 4 years ago

[BUGFIX] MailUtility::parseAddresses() returns @localhost on empty string

parseAddresses should return an array of email addresses ready to be
feed into swiftmailer.
If an empty string is passed to the function, then it returns
"@localhost", which is not a valid email.
Swiftmailer will throw an exception "Address in mailbox given
[@localhost] does not comply with RFC 2822, 3.6.2."
This happens in ContentObjectRenderer->sendNotifyEmail() which is in
turn used by the frontend login forgotten passwort form.

Skip any addresses without a mailbox given.

Resolves: #48247
Releases: 6.2, 6.1
Change-Id: If8724416b3451417db7729dc81abdbd068dc8b10
Reviewed-on: https://review.typo3.org/20905
Reviewed-by: Philipp Gampe
Tested-by: Philipp Gampe

History

#1 Updated by Philipp Gampe over 4 years ago

  • Status changed from New to Accepted
  • Assignee set to Philipp Gampe
  • Priority changed from Should have to Must have
  • PHP Version set to 5.4

#2 Updated by Gerrit Code Review over 4 years ago

  • Status changed from Accepted to Under Review

Patch set 1 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/20839

#3 Updated by Alban Cousinie over 4 years ago

Hello Philipp,

I confirm the fix works on my installation. Thanks a lot for the quick feedback !

Regards,

Alban Cousinié

#4 Updated by Gerrit Code Review over 4 years ago

Patch set 2 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/20839

#5 Updated by Gerrit Code Review over 4 years ago

Patch set 3 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/20839

#6 Updated by Philipp Gampe over 4 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100

#7 Updated by Gerrit Code Review over 4 years ago

  • Status changed from Resolved to Under Review

Patch set 1 for branch TYPO3_6-1 has been pushed to the review server.
It is available at https://review.typo3.org/20905

#8 Updated by Philipp Gampe over 4 years ago

  • Status changed from Under Review to Resolved

Also available in: Atom PDF