Page 1 of 1

Email encoding

Posted: Tue Jan 13, 2009 11:12 am
by valeris
Hello Guys, I use the following code for sending email from flash form.

<?
$to = "mymail@mysite.com";
$msg = "First_Name: $fname\n\n";
$msg = "Last_Name: $lname\n\n";
$msg .= "Tel: $tel\n\n";
$msg .= "Hours: $hours\n\n";
$msg .= "Email: $email\n\n";
$msg .= "Sector: $sector\n\n";
$msg .= "Message: $mess\n\n";

mail($to, $fname, $msg, "From: mysite\nReply-To: $email\n");
?>

Everything works perfectly only by using Latin fonts. What the code needed to be added here in order to get info from email form in UTF-8? Many thanks in advance!!!

Re: Email encoding

Posted: Tue Jan 13, 2009 12:04 pm
by Apollo
Add this header: Content-Type: text/plain; charset=utf-8

i.e.

Code: Select all

mail($to, $fname, $msg, "From: mysite\nReply-To: $email\nContent-Type: text/plain; charset=utf-8\n");
(PS. please use

Code: Select all

tags around your code snippets, so we get fancy markup and syntax highlighting)

Re: Email encoding

Posted: Tue Jan 13, 2009 1:17 pm
by valeris
Thanks!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! :lol: :lol: :lol: :lol: