i'm trying to send an email with a japanese character with PHPmailer, This is my function :
function sendMail()
{
mb_language('ja');
mb_internal_encoding('UTF-8');
$mail = new PHPMailer();
$mail->isSMTP();
$mail->SMTPAuth = true;
$mail->Host = EMAIL_HOST;
$mail->Port = EMAIL_PORT;
$mail->Username = EMAIL_USERNAME;
$mail->Password = EMAIL_PASSWORD;
$mail->SMTPKeepAlive = true;
$mail->Mailer = 'smtp';
$mail->CharSet = 'ISO-2022-JP';
$mail->Encoding = "7bit";
$mail->SMTPDebug = 0;
$mail->From = EMAIL_SET_FROM_EMAIL;
$mail->FromName = mb_encode_mimeheader(EMAIL_SET_FROM_NAME, "ISO-2022-JP-MS");
$mail->addAddress($this->to);
if (!empty($this->replyTo)) {
$mail->addReplyTo($this->replyTo);
}
$mail->isHTML(true);
$mail->Subject = mb_encode_mimeheader($this->subject, "ISO-2022-JP-MS");
$mail->Body = mb_convert_encoding($this->body, "ISO-2022-JP-MS", "UTF-8");
$isSend = $mail->send();
if (!$isSend) {
throw new exception(__METHOD__ . '() ' . $mail->ErrorInfo);
}
}
In the recipient the email body which have Japanese character sometimes broken like this :
Case 1 : エ %j%" : A
Case 2 : My friends Japanese laptop showing several black diamond character with question mark in it. Its on Gmail,
Case 3 : A question mark appear in some Japanese character.
Can any body show me the correct setting for PHP mailer so it can send a Japanese-character mail without unknown character shown in the recipient ?