Re: Mail subject encoding breaks

From: Date: Mon, 11 May 2009 15:58:29 +0000
Subject: Re: Mail subject encoding breaks
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-292446@lists.php.net to get a copy of this message
On 11 May 2009 at 18:25, Thodoris wrote:
Hi gang,
    I am using phpmailer to send some mail notifications in an intranet I've made. This is a sample code:
    
$e->Subject = "This is δφκξγκδφη garbidge κηδφκξγσ";
Hi, I have had success with this in the past: $subject = "This is δφκξγκδφη garbidge κηδφκξγσ"; $e->Subject = mb_encode_mimeheader($subject, "UTF-8", "Q") ; Regards Ian
Thanks Ian this works in most cases but there are times that still breaks the subject. I have experimented with: mb_encode_mimeheader($subject, "UTF-8", "B") as well but nothing seems to be working without problems. I think that this solved my problems since I noticed that it works fine until this moment. function mail_utf8($to, $subject = '(No subject)', $message = '', $header = '') { $header_ = 'MIME-Version: 1.0' . "\r\n" . 'Content-type: text/plain; charset=UTF-8' . "\r\n"; mail($to, "=?UTF-8?B?".base64_encode($subject).'?=', $message, $header_ . $header); } -- Thodoris

« previous php.general (#292446) next »