ZF-2559: Email subject encoding bug

Description

I tried to send letter using charset 'cp1251' or 'win1251'. For this purpose I created new instance of Zend_Mail passed this charset in constructor. Then called functions setSubject and setBodyHtml pointed my message.


$mail = new Zend_Mail('cp1251');
$mail->setSubject('Поздравляем с успешной регистрацией');
$mail->setBodyHtml("Blah-blah");

Receved message has problem with subject. The subject has useless symbol. GMail: 'Поздравляем с успешной регистрацией' ('' means space) Yandex: 'Поздравляем с успешной рег=истрацией' ('' means space) Mail.ru: 'Поздравляем с успешной регE8истрацией'

I think that problem happened around cyrillic symbols.

Thank you!

Comments

protected function _encodeHeader($value)
{
  if (Zend_Mime::isPrintable($value)) {
      return $value;
  } else {
      return '=?' . $this->_charset . '?B?' . Zend_Mime::encodeBase64($value) . '?=';
  }

This should fix your problem, the problem is Zend_Mime::encodeQuotedPrintable looks buggy so I used a B encode (base64) on the subject . This was the quick fix for me, I'll try to put togheter a patch and fix Zend_Mime::encodeQuotedPrintable.

Was this fixed in the repository? If not, this should probably be marked 'won't fix'.

Please verify resolved status.

I wrote the same patch and problem was resolved.

The patch

I attached the 'quick fix' patch, please commit

Another issue should probably be opened for Zend_Mime::encodeQuotedPrintable, more testing with utf-8?

Solved in SVN r13496.

1) Change _encodeHeader() can encode by not only quotedPrintable but also by Base64.

2) Add $_encodingOfHeaders and setter/getter functions.

I changed the name to $_headerEncoding