Mail subject encoding breaks

From: Date: Mon, 11 May 2009 15:25:56 +0000
Subject: Mail subject encoding breaks
Groups: php.general 
Request: Send a blank email to php-general+get-292444@lists.php.net to get a copy of this message
Hi gang, I am using phpmailer to send some mail notifications in an intranet I've made. This is a sample code: <?php // Include PHP Mailer require 'class/class.phpmailer.php'; // Instantiate the mailer $e = new phpmailer(); $e->From = "acount@host.gr"; $e->FromName = "Test"; $e->Mailer = "mail"; $e->Subject = "This is δφκξγκδφη garbidge κηδφκξγσ"; $e->CharSet = "UTF-8"; $e->Body = "H εργασία id: 122 έκλεισε με σχόλια."; $e->AddReplyTo("support@kinetix.gr"); $e->AddAddress("tgol@kinetix.gr"); // $e->to = array("tgol@kinetix.gr"); if ($e->Send()) { print "Mail has been sent successfully."; } else { print "Failed to send mail.<br>".$e->ErrorInfo; } ?> Where mailer class is: <?php require 'class.phpmailer.php'; class mailer extends phpmailer { var $From = "acount@host.gr"; var $FromName = "Test"; var $Mailer = "mail"; var $WordWrap = 200; var $CharSet = "UTF-8"; var $Encoding = "quoted-printable"; // var $Encoding = "base64"; } ?> This script seems to work ok in a freebsd development server I have but a linux production machine breaks the subject's encoding for some unexpected reason. The subject has a mix of English and Greek characters that FreeBSD seems to handle like a charm. Both machines have the same php version (5.2.9) and the scripts encoding is UTF-8. Iconv and mbstring are configured the same way in php.ini (although I am not aware whether phpmailer uses iconv or mbstring). Has anyone had a similar experience? Is it possible that sendmail (which is the underlying tool) breaks the mail encoding? Please any help would be appreciated because this is really driving me crazy. -- Thodoris

« previous php.general (#292444) next »