I want to send a html mail with multi-language in php.
Some part of mail content is from database. And some part user have to enter.
My database is ok. And Unicode utf-8 is used.
When I am retrieving data from database to my web page is ok. And coming in Russian language,
But when I am using same content to send email, the content comes with Unicode character but not in Russia language
I want mail in Russian language.
I am getting right html mail but with some garbage characters instade of original language character.
This is the part of the mail content
output of mail content is ----------------------------------


ÐÐºÐ°Ð´ÐµÐ¼Ð¸Ñ Ð¤ÐµÐ´ÐµÑ€Ð°Ð»ÑŒÐ½Ð¾Ð³Ð¾ агентÑтва ПравительÑтвенной ÑвÑзи и информации при президенте РоÑÑийÑкой Федерации

Ð˜Ð¼Ñ Ð¿Ð¾Ð»ÑŒÐ·Ð¾Ð²Ð°Ñ‚ÐµÐ»Ñ # из # Ð¸Ð¼Ñ Ð²ÑƒÐ·Ð° # приглаÑил Ñ‚ÐµÐ±Ñ Ð²

---------------------------------------------------
This is the part of code of the page sendmail.php, in which
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
is written to display Multilanguage.
My page is displaying language correctly.

my mail code is as follows-------------

<?
$message = "
<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>
<html xmlns='http://www.w3.org/1999/xhtml'>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=UTF-8' />
</head>
<body>

<table width='600' border='0' align='left' cellpadding='0' cellspacing='0'>
<tr valign='top'>
<td align='left'><!--header Section Start here-->
<table width='100%' border='0' cellpadding='0' cellspacing='0'>
<tr>
<td height='35' align='left' bgcolor='#3b5998' style='font-size:14px; color:#FFFFFF; font-family:Arial'> $mail1_invitationsent $mail2_invitationsent</td>
</tr>
</table>
<!--header Section end here here-->
</td>
</tr>
<tr>
<td height='20' colspan='2' align='left' bgcolor='#6d84b4' style='font-size:14px; color:#FFFFFF; font-family:Arial; font-style:italic'> $mail3_invitationsent ($college_name)</td>
</tr>
<tr>
<td><table width='600' align='center' cellspacing='0' cellpadding='0' style='BORDER-RIGHT: 1px solid; BORDER-TOP: 1px solid; BORDER-LEFT: 1px solid; border-bottom: 1px solid; border-top-color:#6d84b4; border-right-color:#6d84b4; border-left-color:#6d84b4; border-bottom-color:#6d84b4' >
<tr>
<td><!--Page body Section Start here-->
<table width='600' border='0' align='center' cellpadding='0' cellspacing='0'>
<tr>
<td valign='top'>
<table width='100%' border='0' align='center' cellpadding='0' cellspacing='0'>
<tr>
<td colspan='3'></td>
</tr>
<tr>
<td width='2%'> </td>
<td colspan='2' align='left' style='font-size:12px; font-family:Arial'>$mail_contents</td>
</tr>
<tr>
<td rowspan='5'> </td>
<td height='10' align='left' style='font-size:12px; font-family:Arial'></td>
<td width='37%' rowspan='5' align='left'> </td>
</tr>
<tr>
<td width='61%' height='8' align='left' style='font-size:12px; font-family:Arial'>$mail4_invitationsent </td>
</tr>
<tr>
<td height='10'></td>
</tr>
<tr>
<td height='8' align='left' style='font-size:12px; font-family:Arial'>$mail5_invitationsent </td>
</tr>
<tr>
<td align='left' valign='top' style='font-size:12px; font-family:Arial'></td>
</tr>
<tr>
<td colspan='3'> </td>
</tr>
</table>
</td>
</tr>
</table>
<table width='100%' border='0' cellspacing='0' cellpadding='0'>
<tr>
<td height='3'></td>
</tr>
<tr>
<td></td>
</tr>
</table>
<!--Page body Section end here-->
</td>
</tr>
</table>
<table width='100%' border='0' cellspacing='0' cellpadding='0'>
<tr>
<td>
</td>
</tr>
</table></td>
</tr>
</table>
</body>
</html>
";
// To send HTML mail, the Content-type header must be set
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=utf-8' . "\r\n";
$headers .= 'From: xxxxx' . "\r\n";
mail($to, $subject, $message, $headers);
?>
----------------------------- end of code-----------------------
some variables are used to change language
and
$mail_contents is the variable of mail contents which is partly from database and party from use input.
Plz. solve my prob

You may have to change your Content-type header to a charset other than utf-8. I believe that's 8-bit ASCII.

Btw, please use [ code ] tags. It keeps formatting, which makes code easier to read.

This article has been dead for over six months. Start a new discussion instead.