Joomla UTF-8 encoding fails on opening the mail Joomla UTF-8 encoding fails on opening the mail php php

Joomla UTF-8 encoding fails on opening the mail


Your code is correct absolutely there is no error in it but its other things failing encoding. As I need message source headers and message to tell you exactly what is happening? I have further no information about are you sending the email as plain text or HTML. But there are generally two issue which are:

Missing Mime-Version

Reason for showing the character wrongly is developers forget to describe the message as MIME Version. if the message is missing the "Mime-Version" header that Internet mail standards require, Webmail will ignore the "charset" header completely, garbling the message unless it's already in the UTF-8 character set.

Showing Subject with Special Characters

As you want to show the subject with utf-8 encoding then you must encode the subject as:

//Setting the Language as Japanmb_language("ja");//Converting the string into Japan Encoding$subject = mb_convert_encoding($subject, "ISO-2022-JP","AUTO");//Now convert the string to MIME Header type$subject = mb_encode_mimeheader($subject);

If the above mentioned things doesn't resolve the problem then request you post the RAW Headers of the Email as it will help in better way to resolve issue.


Are you test to change the charset with .htaccess ?

AddDefaultCharset   UTF-8


Since you indicate in the comments you are using Joomla 1.5, it seems there is an issue with the phpmailer() library in that version that forces the character set of the mailer—on the message—to send things out using the character set setting of iso-8559-1. To fix this open up the core phpmailer() libary here:

[path to your Joomla install]/libraries/phpmailer/phpmailer.php

Around line 50 there is a setting called $CharSet. Change that to utf-8 if it’s not set to that already:

  /**   * Sets the CharSet of the message.   * @var string   */  var $CharSet           = 'utf-8';

You might also want to do search of your Joomla 1.5 codebase for iso-8559-1 to see if a component or library is forcing iso-8559-1 encoding somewhere in the chain of code.

And another setting I would recommend checking is $Encoding around line 63. The default setting seems to be 8bit, but I have had to adjust that in the past to either quoted-printable or base64 to solve some mailing issues on specific setups I was working on.

  /**   * Sets the Encoding of the message. Options for this are "8bit",   * "7bit", "binary", "base64", and "quoted-printable".   * @var string   */  var $Encoding          = '8bit';