Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Mail\Message::getSubject() should return value the way it was set #2334

merged 2 commits into from Sep 13, 2012


None yet
2 participants

Xerkus commented Sep 10, 2012

Message return subject in encoded form which is quite unexpected behaviour for end user

$message->getSubject(); // Subject
//before this PR:
$message->getSubject(); // =?UTF-8?Q?Subject?=

Transport should retrieve encoded Subject header value from headers and not directly from message object.

@weierophinney weierophinney commented on the diff Sep 13, 2012

@@ -179,7 +179,12 @@ protected function prepareRecipients(Mail\Message $message)
protected function prepareSubject(Mail\Message $message)
- return $message->getSubject();
+ $headers = $message->getHeaders();
+ if (!$headers->has('subject')) {
+ return null;
+ }
+ $header = $headers->get('subject');
+ return $header->getFieldValue(HeaderInterface::FORMAT_ENCODED);

weierophinney Sep 13, 2012


Should this also be done for SMTP and/or File transports? or is it an issue only for the Sendmail transport?


Xerkus Sep 13, 2012


Message::getSubject() was used only in sendmail.
I will check if getters for other properties proxied to Headers are used in transports and replace them with direct access too.

@ghost ghost assigned weierophinney Sep 13, 2012

@weierophinney weierophinney merged commit 45b4a39 into zendframework:master Sep 13, 2012

1 check passed

default The Travis build passed

weierophinney commented Sep 13, 2012

Merged to master and release branches.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment