Zend Framework

Email subject encoding bug

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Critical Critical
  • Resolution: Fixed
  • Affects Version/s: 1.0.3, 1.7.2
  • Fix Version/s: 1.7.3
  • Component/s: Zend_Mail
  • Labels:
    None
  • Fix Version Priority:
    Must Have

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("<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!

Issue Links

Activity

Hide
Jonathan Bond-Caron added a comment -

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.

Show
Jonathan Bond-Caron added a comment - 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.
Hide
Wil Sinclair added a comment -

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

Show
Wil Sinclair added a comment - Was this fixed in the repository? If not, this should probably be marked 'won't fix'.
Hide
Wil Sinclair added a comment -

Please verify resolved status.

Show
Wil Sinclair added a comment - Please verify resolved status.
Hide
Sergey Voyachek added a comment -

I wrote the same patch and problem was resolved.

Show
Sergey Voyachek added a comment - I wrote the same patch and problem was resolved.
Hide
Jonathan Bond-Caron added a comment -

The patch

Show
Jonathan Bond-Caron added a comment - The patch
Hide
Jonathan Bond-Caron added a comment -

I attached the 'quick fix' patch, please commit

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

Show
Jonathan Bond-Caron added a comment - I attached the 'quick fix' patch, please commit Another issue should probably be opened for Zend_Mime::encodeQuotedPrintable, more testing with utf-8?
Hide
Satoru Yoshida added a comment -

Solved in SVN r13496.

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

2) Add $_encodingOfHeaders and setter/getter functions.

Show
Satoru Yoshida added a comment - Solved in SVN r13496. 1) Change _encodeHeader() can encode by not only quotedPrintable but also by Base64. 2) Add $_encodingOfHeaders and setter/getter functions.
Hide
Satoru Yoshida added a comment -

I changed the name to $_headerEncoding

Show
Satoru Yoshida added a comment - I changed the name to $_headerEncoding

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved:

Time Tracking

Estimated:
Not Specified
Original Estimate - Not Specified
Remaining:
0m
Remaining Estimate - 0 minutes
Logged:
3h
Time Spent - 3 hours