Bug #90040

Mailer::send sets replyTo Address in wrong order (name as mail and vice versa)

Added by Sven Nußbaum about 2 months ago. Updated about 1 month ago.

Status:
Resolved
Priority:
Should have
Assignee:
-
Category:
Miscellaneous
Target version:
Start date:
2019-12-30
Due date:
% Done:

100%

TYPO3 Version:
10
PHP Version:
7.2
Tags:
mailer, rfc
Complexity:
easy
Is Regression:
Sprint Focus:

Description

  /typo3/sysext/core/Classes/Mail/Mailer.php:108

$replyTo = MailUtility::getSystemReplyTo();
...
$replyTo = new Address(reset($replyTo), $address);

Line 108 is setting "new Address" as replyTo using the value of the array as address and $address as name.

Issue:
The array returned from MailUtility::getSystemReplyTo() is different depending on defaultMailReplyToName is being set in $GLOBALS['TYPO3_CONF_VARS']['MAIL'].
When set, address is key and name is value. When not set address is value.

        if (!empty($mailConfiguration['defaultMailReplyToName'])) {
            $replyTo = [$replyToAddress => $mailConfiguration['defaultMailReplyToName']];
        } else {
            $replyTo = [$replyToAddress];
        }

reset($replyTo) therefore returns the name when defaultMailReplyToName is filled leading to invalid RFC validation and exception when sending mail:

RFC compliance problem
Please verify $GLOBALS['TYPO3_CONF_VARS']['MAIL']['defaultMailFromAddress'] is a valid mail address. Error message: Email "ACME" does not comply with addr-spec of RFC 2822.

Associated revisions

Revision 953e1b34 (diff)
Added by Benni Mack about 1 month ago

[BUGFIX] Properly set Reply-To address in mailer

The symfony/mailer instance needs an email address in the form
of new Address($emailAddress, $name);

The MailUtility::getSystemReplyTo() returns a strange (Swiftmailer-like)
syntax, which was implemented wrong when migrating to Symfony/Mailer.

The change switches the constructor arguments to be used in
the correct order ($email, $name).

Resolves: #90040
Releases: master
Change-Id: I2f2bfc67b47fdd1327895c96bd27b2d481805a1b
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/62836
Tested-by: Markus Klein <>
Tested-by: TYPO3com <>
Tested-by: Georg Ringer <>
Reviewed-by: Markus Klein <>
Reviewed-by: Mathias Brodala <>
Reviewed-by: Georg Ringer <>

History

#1 Updated by Sven Nußbaum about 2 months ago

  • Target version changed from Candidate for Major Version to next-patchlevel
  • Complexity set to easy

#2 Updated by Sven Nußbaum about 2 months ago

  • Description updated (diff)

#3 Updated by Gerrit Code Review about 1 month ago

  • Status changed from New to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/62836

#4 Updated by Gerrit Code Review about 1 month ago

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/62836

#5 Updated by Gerrit Code Review about 1 month ago

Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/62836

#6 Updated by Benni Mack about 1 month ago

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

Also available in: Atom PDF