Reputation: 21
I'm newbie to PHP, HTML and to programming at all. I'm trying to create a contact form with PHP and HTML. Everything is working fine, and i'm able to get the e-mails. Except of one thing, If i'm trying to fill the form with another language, In my case it's hebrew, The mail i'm getting is with gibrish. I saved the html file with the UTF-8 encoding, and i added the meta code. checked my outlook encoding and checked the mails i'm getting with a webinteface and it's still gibrish.
Any ideas?
Upvotes: 2
Views: 768
Reputation: 868
First of all, try to "Echo" the content of the email to the browser instead of sending it out.
Then you can take care about the format of the email.
If you are sending email, you need to set the proper headers for the email just as you do for the website. For UTF-8, you would do:
$headers = "From: ExRobot <[email protected]>\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/plain; charset=utf-8\r\n";
$headers .="Content-Transfer-Encoding: 8bit";
If your subject also might include foreign languages you can set it to
"=?utf-8?B?".base64_encode($subject)."?="
If this does not help, post a complete sample email here as you get it. this will help a lot to understand what is wrong.
Upvotes: 1