Breaking: #110196 - PHP class Rfc822AddressesParser removed 

See forge#110196

Description 

The PHP class \TYPO3\CMS\Core\Mail\Rfc822AddressesParser has been removed. The class was a modernized copy of the PEAR package pear/mail , dating back to 2010, and was only used internally by \TYPO3\CMS\Core\Utility\MailUtility::parseAddresses() .

This internal usage is now based on \Symfony\Component\Mime\Address of the symfony/mime package, which TYPO3 already utilizes for sending emails.

Impact 

Instantiating or referencing the class Rfc822AddressesParser will raise a fatal PHP error.

In addition, MailUtility::parseAddresses() now strips surrounding double quotes from display names: parsing '"last, first" <email@example.org>' previously returned the display name '"last, first"' and now returns 'last, first' . Quoting is re-applied automatically by symfony/mime when composing a mail message.

Affected installations 

TYPO3 installations with third-party extensions directly using the class Rfc822AddressesParser . The extension scanner reports any usage as a strong match.

Migration 

To parse a comma-separated list of email addresses with optional display names, use \TYPO3\CMS\Core\Utility\MailUtility::parseAddresses() , which continues to work as before.

Alternatively, use the symfony/mime API directly to parse a single mailbox string:

use Symfony\Component\Mime\Address;

$address = Address::create('John Doe <john.doe@example.org>');
$email = $address->getAddress();
$name = $address->getName();
Copied!