[Phpwm] unicode email with Zend_Mail - what about the subject?
David Goodwin
david at codepoets.co.uk
Tue Sep 9 20:34:56 UTC 2008
Hi,
I've been trying to send a fully unicode 'compliant' email - where the
to/from/subject/body can all contain unicode characters.
I'm able to get the to/from/body encoded correctly, but the subject
seems to be awkward (i.e. refusing to encode correctly!)
So far, I've only tried using Zend_Mail, with something like the below :
(the commented out line shows one attempt I had at fixing the subject,
but it didn't seem to work for Thunderbird)
(I suspect the repetitive utf-8's aren't needed aside from in the
constructor; I was grasping at straws...)
<?php
require_once('Zend/Mail.php');
$mail = new Zend_Mail('UTF-8');
$mail->setbodytext("hello world - here is some unicode stuff 汉语/漢語", 'utf-8', Zend_Mime::ENCODING_BASE64);
//$mail->setSubject(mb_encode_mimeheader("See 汉语/漢語", 'UTF-8', 'P'));A
$mail->setSubject("See 汉语/");
$mail->setFrom('david at example.org', 'rah rah 汉语/漢語');
$mail->addTo('david at example.org', 'rah rah 汉语/漢語');
$mail->send();
Ideas/suggestions welcome.
I'll try using a different library (e.g.
phpmailer) tomorrow, as perhaps it's a bug in Zend_Mail...
David.
--
David Goodwin
[ david at codepoets dot co dot uk ]
[ http://www.codepoets.co.uk ]
More information about the Phpwm
mailing list