Issues

ZF-2559: Email subject encoding bug

Issue Type: Bug Created: 2008-02-04T09:11:04.000+0000 Last Updated: 2012-03-28T02:16:27.000+0000 Status: Resolved Fix version(s): - 1.7.3 (19/Jan/09)

Reporter: Sergey Voyachek (voyachek) Assignee: Satoru Yoshida (satoruyoshida) Tags: - Zend_Mail

Related issues: - ZF-6263

Attachments: - header.patch

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.

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

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

Posted by Jonathan Bond-Caron (jbondc) on 2008-02-08T12:11:40.000+0000

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.

Posted by Wil Sinclair (wil) on 2008-12-17T13:30:24.000+0000

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

Posted by Wil Sinclair (wil) on 2008-12-17T13:31:02.000+0000

Please verify resolved status.

Posted by Sergey Voyachek (voyachek) on 2008-12-18T01:57:32.000+0000

I wrote the same patch and problem was resolved.

Posted by Jonathan Bond-Caron (jbondc) on 2008-12-18T06:31:37.000+0000

The patch

Posted by Jonathan Bond-Caron (jbondc) on 2008-12-18T06:35:26.000+0000

I attached the 'quick fix' patch, please commit

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

Posted by old of Satoru Yoshida (yoshida@zend.co.jp) on 2009-01-02T22:54:20.000+0000

Solved in SVN r13496.

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

  2. Add $_encodingOfHeaders and setter/getter functions.

Posted by old of Satoru Yoshida (yoshida@zend.co.jp) on 2009-01-23T06:46:01.000+0000

I changed the name to $_headerEncoding

Have you found an issue?

See the Overview section for more details.

Copyright

© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.

Contacts