Uploaded image for project: 'eZ Publish / Platform'
  1. eZ Publish / Platform
  2. EZP-21567

Blank e-mail subject line with multi-byte characters (iconv_mime_encode: Unknown error)

    Details

      Description

      In some conditions, notifications (such as sub-tree modification alerts) for content with multi-byte characters will have a blank subject line; this only (AFAIK) applies if the message is sent through the SMTP Transport class in eZ Components (which is the case if eZ Publish is configured to send messages through an SMTP server).

      After configuring MailSettings to use an SMTP server, the following script reproduces the issue:

      #!/usr/bin/env php
      <?php
       
      require 'autoload.php';
       
      $cli = eZCLI::instance();
       
      $script = eZScript::instance(
          array(
              'description' => "",
              'use-session' => false,
              'use-modules' => true,
              'use-extensions' => true
          )
      );
      $script->startup();
      $script->initialize();
       
      $mail = new eZMail();
       
      $mail->setSender('SENDER E-MAIL ADDRESS GOES HERE');
      $mail->setReceiver('RECEIVER E-MAIL ADDRESS GOES HERE');
       
      ///////////////
      $mail->setSubject('This is a test');
      $mail->setBody("1 test mail");
      eZMailTransport::send($mail);
      ///////////////
      $mail->setSubject('Folder "ログイン前トップ" は更新されました [cms.mipotecq.biz - フォト&amp;ムービー]');
      $mail->setBody("2 full subject");
      eZMailTransport::send($mail);
      ///////////////
      $mail->setSubject('Folder "ログイン前トップ" は更新されました');
      $mail->setBody("3 half left");
      eZMailTransport::send($mail);
      ///////////////
      $mail->setSubject(' [cms.mipotecq.biz - フォト&amp;ムービー]');
      $mail->setBody("4 half right");
      eZMailTransport::send($mail);
      ///////////////
      $mail->setSubject(' は更新されました [cms.mipotecq.biz');
      $mail->setBody("5 center");
      eZMailTransport::send($mail);
       
      ///////////////
      $mail->setSubject('"ログイン前トップ"');
      $mail->setBody("6 content");
      eZMailTransport::send($mail);
      ///////////////
      $mail->setSubject(' は更新されました');
      $mail->setBody("7 content type");
      eZMailTransport::send($mail);
      ///////////////
      $mail->setSubject('Folder "ログイン前トップ"');
      $mail->setBody("8 left");
      eZMailTransport::send($mail);
      ///////////////
      $mail->setSubject('Folder "ログイ');
      $mail->setBody("9 Folder");
      eZMailTransport::send($mail);
       
      $script->shutdown();
      

      Example notice displayed during script execution (repeats a few times, for each affected message):

      PHP Notice:  iconv_mime_encode(): Unknown error (7) in /var/www/ezp/500-ezp/ezpublish_legacy/lib/ezc/Mail/src/interfaces/part.php on line 381
      PHP Stack trace:
      PHP   1. {main}() /var/www/ezp/500-ezp/ezpublish_legacy/script.php:0
      PHP   2. eZMailTransport::send() /var/www/ezp/500-ezp/ezpublish_legacy/script.php:66
      PHP   3. eZSMTPTransport->sendMail() /var/www/ezp/500-ezp/ezpublish_legacy/lib/ezutils/classes/ezmailtransport.php:56
      PHP   4. ezcMailSmtpTransport->send() /var/www/ezp/500-ezp/ezpublish_legacy/lib/ezutils/classes/ezsmtptransport.php:86
      PHP   5. ezcMailPart->generate() /var/www/ezp/500-ezp/ezpublish_legacy/lib/ezc/Mail/src/transports/smtp/smtp_transport.php:490
      PHP   6. ezpMail->generateHeaders() /var/www/ezp/500-ezp/ezpublish_legacy/lib/ezc/Mail/src/interfaces/part.php:434
      PHP   7. ezcMail->generateHeaders() /var/www/ezp/500-ezp/ezpublish_legacy/kernel/private/classes/ezpmail.php:31
      PHP   8. ezcMailPart->generateHeaders() /var/www/ezp/500-ezp/ezpublish_legacy/lib/ezc/Mail/src/mail.php:381
      PHP   9. iconv_mime_encode() /var/www/ezp/500-ezp/ezpublish_legacy/lib/ezc/Mail/src/interfaces/part.php:381
      

      9 messages will be sent, some of them missing a subject line. This issue does not appear to be present when using sendmail.

        Issue Links

          Activity

          Hide
          Filipe Dobreira (Inactive) added a comment -

          QA Approved.

          Show
          Filipe Dobreira (Inactive) added a comment - QA Approved.
          Hide
          Jérôme Vieilledent (Inactive) added a comment - - edited

          If on master: just do a

          php composer.phar update zetacomponents/mail
          

          If in your composer.json you have something like zetacomponents/mail: dev-master#abc1234, remove the hash reference (including # and do the update.

          Show
          Jérôme Vieilledent (Inactive) added a comment - - edited If on master: just do a php composer.phar update zetacomponents/mail If in your composer.json you have something like zetacomponents/mail: dev-master#abc1234 , remove the hash reference (including # and do the update.
          Show
          Jérôme Vieilledent (Inactive) added a comment - Fixed in ZetaComponents Mail master: https://github.com/zetacomponents/Mail/commit/71b05a428fa448b68ab888651fd6de7176a149b6
          Hide
          Jérôme Vieilledent (Inactive) added a comment -

          PR in ZetaComponents Mail component: https://github.com/zetacomponents/Mail/pull/8

          Show
          Jérôme Vieilledent (Inactive) added a comment - PR in ZetaComponents Mail component: https://github.com/zetacomponents/Mail/pull/8
          Hide
          Jérôme Vieilledent (Inactive) added a comment -

          OK, the problem comes indeed from ZetaComponents Mail.

          Actually, the example given uses Kanji and Katakana characters, which are multi-byte. Will test solution from Jérôme Cohonner

          Show
          Jérôme Vieilledent (Inactive) added a comment - OK, the problem comes indeed from ZetaComponents Mail . Actually, the example given uses Kanji and Katakana characters, which are multi-byte. Will test solution from Jérôme Cohonner

            People

            • Assignee:
              Unassigned
              Reporter:
              Filipe Dobreira (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

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