Some system has problem if with E-mail subject is in Chinese. For example, I installed Drupal in a hosting server in the USA. When I put Chinese in the subject in the email, the system cannot send the email.
I got the message as following:
Drupal have following warrning:
warning: mail() [function.mail]: Bad parameters to mail() function, mail not sent. in /home/content/h/o/s/hosais/html/includes/mail.inc on line 197.
Solution (Using UTF-8, base64)
I solved the problem by changing the /includes/mail.inc by adding the following code. The idea is change the subject as
$subject = “=?UTF-8?B?” . base64_encode($subject) . “?=”;
Source code
mail.inc, Line 186:
return mail(
$message['to'],
//mime_header_encode($message['subject']), <== marked this
//“=?UTF-8?B?” . base64_encode($subject) . “?=”;
mime_header_encode("=?UTF-8?B?".base64_encode($message['subject'])."?="), //<== added this line
// Note: e-mail uses CRLF for line-endings, but PHP's API requires LF.
// They will appear correctly in the actual e-mail that is sent.
str_replace("\r", '', $message['body']),
// For headers, PHP's API suggests that we use CRLF normally,
// but some MTAs incorrecly replace LF with CRLF. See #234403.
join("\n", $mimeheaders)
...