Mail subject encoding problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi gang,
I have developed a web intranet and I have added mail notification when some tasks are done. I am using the mail() function to send mail since no advanced features are needed like attachments. So I am facing a weird problem with the mail subject encoding. Let me explain.

I am having a FreeBSD web server for development that is working like a charm when sending mail using something like this:

// Define the e-mail content
$email = "foo@foo,com";
$subject = "H εργασία: (id: 1868) έκλεισε χωρίς σχόλια.";
$message = "Αυτό είναι ένα τέστ. Αυτό είναι ένα τέστ. Αυτό είναι ένα τέστ.";
// $subject = mb_encode_mimeheader($subject,'iso-8859-1','B');

// Set the headers and send the e-mail
$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=utf-8' . "\r\n";
$headers .= "From: test@xxxxxxx\r\nReply-To: test@xxxxxxx\r\nX-Mailer: PHP";
mail($email,$subject,$message,$headers);

The language in both subject and mail body is Greek. But when I am uploading this to a Linux CentOS 5.2 server this mail is being sent but the subject is rubbish. All encodings are in UTF-8 (the php file, the encoding of the mail client etc) so to solve this I have added the mb_encode_mimeheader line.

This quite many times although sometimes it works. I have also tried to set quoted-printable mime encoding with similar results.

FreeBSD has PHP 5.2.8
Linux has PHP 5.2.5
The php.ini used is almost identical.

Any ideas on this ??

--
Thodoris


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux