EllisLab text mark
Advanced Search
     
email subject in utf 8 is not work!
Posted: 15 July 2010 01:53 AM   [ Ignore ]
Joined: 2010-07-15
22 posts

this is subject in Thai language.
$subject = “หัวข้อของอีเมล์ภาษาไทย UTF-8”

if i just use

$this->email->subject($subject); 

subject in email is

หัวข้อ��ทย UTF-8

 

i have to add encode utf-8 for multi language subject work (refer from http://www.php.net/manual/en/function.mail.php)
then i use this code

'=?UTF-8?B?'.base64_encode($subject).'?=' 

and send…
subject in email is

=?UTF-8?B?4Lir4Lix4Lin4LiC4LmJ4Lit4LiC4Lit4LiH4Lit4Li14LmA4Lih4Lil4LmM4Lig4Liy4Lip4Liy4LmE4LiX4LiiIFVURi04?=

 

but..

i check on system/libraries/Email.php page
comment/remove this line

$subject $this->_prep_q_encoding($subject); 

and send again.
it’s work!

so.. i don’t know what’s that line for?
for make subject utf-8 won’t work?
is there a way to make it work without mess with ci library?

thank you

 Signature 

ooooooooo

 
Posted: 10 August 2010 09:07 AM   [ Ignore ]   [ # 1 ]   [ Rating: 0 ]
Joined: 2008-12-11
18 posts

You can’t do anything without modifying the ci library or extending the email library. I have the similar problem. I don’t know why there’s a need for _prep_q_encoding, because ‘=?utf-8?B?’. base64_encode($subject). ‘?=’ seems to work everywhere in every situation.

 
Posted: 10 August 2010 09:36 AM   [ Ignore ]   [ # 2 ]   [ Rating: 0 ]
Joined: 2008-12-11
18 posts

Put

class MY_Email extends CI_Email
{
    
/**
     * Set Email Subject
     *
     * @access    public
     * @param    string
     * @return    void
     */
    
function subject($subject)
    
{
        $subject 
'=?'$this->charset .'?B?'base64_encode($subject) .'?=';
        
$this->_set_header('Subject'$subject);
    
}

this to your application / libraries / MY_Email.php

 
Posted: 22 February 2012 12:43 PM   [ Ignore ]   [ # 3 ]   [ Rating: 0 ]
Joined: 2012-02-22
1 posts

Just to let you all know.
All emails i sended from CI had ‘=?UTF-8?B?’ as subject, i diged the wrong direction so it costed me “some” time to find out that the problem was that i sended an empty string to the subject (because of empty lang file).
Case solved wink
Cheers,
Gerard

 
Posted: 22 October 2012 12:31 PM   [ Ignore ]   [ # 4 ]   [ Rating: 0 ]
Joined: 2012-10-22
1 posts

@Jazmo:

How do I load this library? This doesn’t work:

$this->load->library('MY_Email'
 
Posted: 22 October 2012 12:47 PM   [ Ignore ]   [ # 5 ]   [ Rating: 0 ]
Avatar
Joined: 2012-01-09
117 posts

This issue has already been fixed in CodeIgniter’s GitHub repository. You can get the fixed version from here:
https://github.com/EllisLab/CodeIgniter/blob/develop/system/libraries/Email.php

 
Posted: 25 October 2012 04:20 AM   [ Ignore ]   [ # 6 ]   [ Rating: 0 ]
Joined: 2012-10-24
3 posts

Thank you

 Signature 

iPad/iPhone Game downloads
—-http://www.megapick.net