Email encoding

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
valeris
Forum Newbie
Posts: 2
Joined: Tue Jan 13, 2009 11:04 am

Email encoding

Post 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!!!
User avatar
Apollo
Forum Regular
Posts: 794
Joined: Wed Apr 30, 2008 2:34 am

Re: Email encoding

Post 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)
valeris
Forum Newbie
Posts: 2
Joined: Tue Jan 13, 2009 11:04 am

Re: Email encoding

Post by valeris »

Thanks!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! :lol: :lol: :lol: :lol:
Post Reply