zendframework / zend-mail

Mail component from Zend Framework
BSD 3-Clause "New" or "Revised" License
96 stars 111 forks source link

Fix AddressList toString method to quote semicolon #230

Open glensc opened 5 years ago

glensc commented 5 years ago

Certain input of AddressList headers, cannot be converted to string and back to header object because of incorrect quoting:

From: "Foo;" <root@example.com>

gets incorrectly converted as

From: Foo; <root@example.com>

but ; is address separator, so it needs to be quoted:

From: "Foo;" <root@example.com>

The problem I discovered internally when using Storage\Message with Headers input, therefore testing that method is included in the unit test:

$message = new Message(['headers' => new Headers(), 'content' => (string)$body]);

// Mime\Decode::splitMessage calls toString on headers object which creates invalid result:
if ($message instanceof Headers) {
    $message = $message->toString();
}
glensc commented 5 years ago

@weierophinney, @Xerkus can you take care of this?

glensc commented 5 years ago

this is a regression from #147 as it added ; separator support that's why (i believe) this exception is caught.

however, there should not be an assumption that only zend-mail is used for reading writing mail messages.

weierophinney commented 4 years ago

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/14.

weierophinney commented 4 years ago

This repository has been moved to laminas/laminas-mail. If you feel that this patch is still relevant, please re-open against that repository, and reference this issue. To re-open, we suggest the following workflow: