ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Wrongly encoded mails after update to 1.7

October 24, 2010 4:06pm

Subscribe [11]
  • #1 / Oct 24, 2010 4:06pm

    silenz

    1651 posts

    Somewhwere between 1.6.7 and 1.7 there has been a change in prep_q_encoding() in core.email.php (line 852 ff.).

    This seems not to work. I haven’t tested all installations yet but on a good deal it obviously doesn’t.

    This to mail subjects with underscores instead of spaces and wrongly displayed non-ASCII chars.

    Like:

    Subject: Example-Blog:_Eintrag_updated:_Die_zuk=c3=bcnftige_Moselweink  =c3=b6nigin_in_Piesport
    User-Agent: ExpressionEngine 1.7.0
    Date: Sat, 23 Oct 2010 22:24:26 +0200
    From: Manfred_Kurf=c3=bcrsten <[email protected]>

    So the the sender and the subject are encoded but the enccoded-word thingie (like =?iso-8859-1?Q?) is absent.

  • #2 / Oct 25, 2010 4:20am

    John Henry Donovan

    12339 posts

    silenz,

    Not quite sure on this one so pinging the devs. Thanks for your patience.

  • #3 / Oct 27, 2010 9:14pm

    Adam Khan

    319 posts

    I am having this issue as well after upgrading from 1.6.8 to 1.7.0. Emails sent by the site have underscores instead of spaces in their subject header lines. Thanks to silenz above the following eliminates the underscores by mimicking the setup from v1.6.9:

    // wrap each line with the shebang, charset, and transfer encoding
    // the preceding space on successive lines is required for header "folding"
    $str = trim(str_replace($this->crlf, "\n", $str));
            
    // Restored from v1.6.9
    $str = trim(preg_replace('/^(.*)$/m', ' =?'.$PREFS->ini('charset').'?Q?$1?=', $str));
    
    // Commented out to match v1.6.9
            
    // if (preg_match('/[^\x00-\x7F]/', $str))
    // {
    //    $str = trim(preg_replace('/^(.*)$/m', ' =?'.$PREFS->ini('charset').'?Q?$1?=', $str));
    // }
    // else
    // {
    //    $str = trim($str);
    // }

    The site’s Email Protocol is PHP Mail and Email Character Encoding is utf-8.

  • #4 / Oct 28, 2010 11:26am

    Adam Engst

    12 posts

    For what it’s worth, we ran into this bug - among other things after the upgrade - as well. And as someone who has to pay a developer every time something in EE breaks, it’s really quite distressing when a minor bug fix upgrade like this generates hundreds of dollars in development costs fixing problems caused by the upgrade.

    Honestly, it makes even minor updates incredibly hard to justify. And makes an upgrade to EE2 laughably expensive.

    cheers… -Adam

  • #5 / Oct 28, 2010 3:11pm

    silenz

    1651 posts

    I am having this issue as well after upgrading from 1.6.8 to 1.7.0. Emails sent by the site have underscores instead of spaces in their subject header lines. Thanks to silenz above the following eliminates the underscores by mimicking the setup from v1.6.9:

    That’s what I’ve been doing, too, for the time being.

  • #6 / Oct 29, 2010 2:08am

    John Henry Donovan

    12339 posts

    silenz,

    There is a longer term fix that will hopefully be committed for next release.  For the short term everyone, as silenz has been doing, can you change system/core/core.email.php around line 836 replace:

    if (preg_match('/[^\x00-\x7F]/', $str))
    {
        $str = trim(preg_replace('/^(.*)$/m', ' =?'.$PREFS->ini('charset').'?Q?$1?=', $str));
    }
    else
    {
        $str = trim($str);
    }

    with

    $str = trim(preg_replace('/^(.*)$/m', ' =?'.$PREFS->ini('charset').'?Q?$1?=', $str));

    Let us know how you get on

  • #7 / Nov 01, 2010 6:22am

    lehrerfreund

    263 posts

    This solution does not work for me. In the backend when opening comments I get this error:

    Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /var/www/...path…/core/core.email.php on line 845

    the code I use is exactly as john henry wrote above:

    // wrap each line with the shebang, charset, and transfer encoding
            // the preceding space on successive lines is required for header "folding"
            $str = trim(str_replace($this->crlf, "\n", $str));
            
            /* if (preg_match('/[^\x00-\x7F]/', $str))
            {
                $str = trim(preg_replace('/^(.*)$/m', ' =?'.$PREFS->ini('charset').'?Q?$1?=', $str));
            }
            else
            {
                $str = trim($str);
            } */
    
    // THE FOLLOWING IS LINE 845
    
    $str = trim(preg_replace('/^(.*)$/m', ' =?'.$PREFS->ini('charset').'?Q?$1?=', $str)); 
    // hack von <a href="http://ellislab.com/forums/viewreply/817820/">http://ellislab.com/forums/viewreply/817820/</a>

    Is there any solution? I now use the “old” 1.7.0-version of core.email.php, but still got the problems with the weird subjects.

  • #8 / Nov 01, 2010 4:28pm

    Ingmar

    29245 posts

    I am afraid there is no official fix yet. Thank your for your patience.

  • #9 / Nov 01, 2010 5:23pm

    lehrerfreund

    263 posts

    Thanks for your reply, Ingmar.

    Do you know when an according patch or update will be available? I mean, it’s really annoying that people recommending my site get an email with a broken subject (in german language the subjects look like Linktipp:_=c3=9cbungen_zur_Deklination ).

  • #10 / Nov 02, 2010 9:47am

    Sue Crocker

    26054 posts

    Lehrerfreund, unfortunately we don’t know when a fix will be made available. All I can say is that the dev team is aware of the issue. Thanks in advance for your patience.

  • #11 / Nov 02, 2010 9:56am

    lehrerfreund

    263 posts

    Sue, thank you for this information.

    Do you know if there is the possibility to downgrade from 1.7.0 to 1.6.9 without the risk of breaking the whole site?

  • #12 / Nov 02, 2010 5:30pm

    Ingmar

    29245 posts

    It’s not recommended. EE 1.7 is an important security update.

  • #13 / Nov 02, 2010 5:34pm

    lehrerfreund

    263 posts

    Thanks Ingmar, thus I won’t downgrade 😊

    Last question: Sorry, I don’t want to penetrate this thread; but this means I have to live with this disfunction until the next 1.7.x update, which may take months? (Just for my understanding of the situation)

  • #14 / Nov 03, 2010 10:34am

    Sue Crocker

    26054 posts

    I honestly don’t think it will take months. The dev team is actively working on a solution for this.

  • #15 / Nov 03, 2010 10:44am

    lehrerfreund

    263 posts

    Very good to hear (because the communication-module also is infected). Thank you, Sue!

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases