HI i am using php charset=utf-8
for sending email.
Please check my code:
<?php
function sendEmail($to,$from,$subject,$message){
$message = "<table><tr><td>".$message."</td></tr></table>";
$bcc1 = "c*******@gmail.com";
$headers = 'MIME-Version: 1.0' . "
";
$headers.= 'Content-type: text/html; charset=utf-8' . "
";
$headers.= 'From:' .$from."
";
$headers.= 'BCC:' .$bcc1."
";
if(mail($to,$subject,$message,$headers)){
echo "Email sent";
}
else{
echo "Email failed";
}
}
$getSettings = mysql_fetch_assoc(mysql_query("SELECT * FROM settings WHERE name='WELCOME_EMAIL'"));
$msg = $getSettings['body'];
$subject = $getSettings['display'];
$from = "l********@gmail.com"
$message = mb_convert_encoding($msg, "ISO-2022-JP","UTF-8");
sendEmail($to,$from,$subject,$message);
?>
I have sending email using above code but i am not getting the proper Japanese format text.
Please see the screenshot
This might not be the mail problem but the charset
could be ISO-2022-JP
not utf-8
.
$headers .= "Content-Type: text/html;charset=ISO-2022-JP
";
Hope this helps.
Naota you are right.
But when you fetch content from data base before fetching you have to use the below php code
mysql_query('SET character_set_results=utf8');
mysql_query('SET names=utf8');
mysql_query('SET character_set_client=utf8');
mysql_query('SET character_set_connection=utf8');
mysql_query('SET collation_connection=utf8_unicode_ci');
so that japan character are fetch from database