Path

ez projects / cjw_newsletter / forum / general / sender name charset encoding / re: sender name charset enc...


Sender name charset encoding

You need to be logged in to post messages in the forums. New users may register here.

Simon Boyer

Member since:
09 March 2011

Posts: 49

Wednesday 30 November 2011 12:16:47 pm

Hi,

The sender name is not displayed properly in email subject, due to a bad charset encoding.
Other notification emails (registration, etc...) are correctly encoded.

Any idea ?

Thanks !

--
Simon Boyer
Developer at Open Wide

Up

Felix Woldt

Member since:
17 February 2006

Posts: 75

Tuesday 20 December 2011 8:57:12 am

Hi Simon,

yes it's true. The bug is fixed in the next newsletter version.
We had to set the charset to utf-8 for all ezcMailAddress()

Here is the diff:




Index: cjwnewslettermail.php


===================================================================


--- cjwnewslettermail.php       (revision 18881)


+++ cjwnewslettermail.php       (revision 18882)


@@ -167,9 +167,13 @@


        $mail->charset = $emailCharset;


        $mail->subjectCharset = $emailCharset;


        // from and to addresses, and subject


-       $mail->from = new ezcMailAddress( trim( $emailSender ), $emailSenderName );


+       $mail->from = new ezcMailAddress( trim( $emailSender ),


+                                         $emailSenderName,


+                                         $mail->charset );


        // returnpath for email bounces


-       $mail->returnPath = new ezcMailAddress( trim( $emailSender ) );


+       $mail->returnPath = new ezcMailAddress( trim( $emailSender ),


+                                               '',


+                                               $mail->charset );


 

        if ( $isPreview )


        {


@@ -179,13 +183,17 @@


                // check if email


                if ( $receiver != '' )


                {


-                   $mail->addTo( new ezcMailAddress( trim( $receiver ), 'NL Test Receiver'. $index ) );


+                   $mail->addTo( new ezcMailAddress( trim( $receiver ),


+                                                     'NL Test Receiver'. $index,


+                                                      $mail->charset ) );


                }


            }


        }


        else


        {


-           $mail->addTo( new ezcMailAddress( trim( $emailReceiver ), $emailReceiverName ) );


+           $mail->addTo( new ezcMailAddress( trim( $emailReceiver ),


+                                             $emailReceiverName,


+                                             $mail->charset ) );


        }


 

        if ( array_key_exists( 'html', $emailBodyArray ) == false )


@@ -241,7 +249,7 @@


        // set 'x-cjwnl-' mailheader


        foreach( $this->ExtraEmailHeaderItemArray as $key => $value )


        {


-           $mail->setHeader( $key, $value );


+           $mail->setHeader( $key, $value, $mail->charset );


        }


 

        $mail->build();


@@ -459,4 +467,4 @@


 

 }


 

-?>


\ No newline at end of file


+?>


 

 

Up

Simon Boyer

Member since:
09 March 2011

Posts: 49

Thursday 22 December 2011 11:08:30 am

Ok,

Thanks a lot !

I will test this update :)

--
Simon Boyer
Developer at Open Wide

Up

Simon Boyer

Member since:
09 March 2011

Posts: 49

Wednesday 18 April 2012 9:53:02 am

Hi,

I tried your solution, but I obtain "=?utf-8?Q?" in sender field...

--
Simon Boyer
Developer at Open Wide

Up

You need to be logged in to post messages in the forums. New users may register here.