zend-mail icon indicating copy to clipboard operation
zend-mail copied to clipboard

Quotes are stripped in MIME-encoded from header values in Zend\Mail

Open GeeH opened this issue 9 years ago • 1 comments

This issue has been moved from the zendframework repository as part of the bug migration program as outlined here - http://framework.zend.com/blog/2016-04-11-issue-closures.html


Original Issue: https://api.github.com/repos/zendframework/zendframework/issues/7593 User: @dendemann Created On: 2015-06-23T10:52:42Z Updated At: 2015-10-25T07:17:23Z Body If a mime encoded "from" header value contains quotes, they are thrown away. Its because AbstractAddressList::fromString uses str_getcsv function to split multiple fields. str_getcsv also removes the quotes.

Can be reproduced using:

$message =
iconv_mime_encode('From', '"Quoted" <[email protected]>', ['scheme' => 'Q']) . "\r\n"
."To: [email protected]\r\n"
."Subject: plain text email example\r\n"
. "Mime-Version: 1.0\r\n"
. "Content-Type: text/plain\r\n"
."\r\n"
."I am a test message\r\n";

$msg = Zend\Mail\Message::fromString($message);
echo $msg->toString();

Result:

From: Quoted <[email protected]>
To: [email protected]
Subject: plain text email example
MIME-Version: 1.0
Content-Type: text/plain

I am a test message

The quotes around the word Quoted are gone. Would a simple explode be sufficient here instead of str_getcsv?


GeeH avatar Jun 28 '16 12:06 GeeH

This repository has been closed and moved to laminas/laminas-mail; a new issue has been opened at https://github.com/laminas/laminas-mail/issues/56.

michalbundyra avatar Jan 15 '20 19:01 michalbundyra