evlj Posted May 28, 2011 Share Posted May 28, 2011 Hi there guys, can any1 help me out to sort this thing. I'm using a simple php email script to send emails from online form (registration). Since i'm using unicode (cyrilic) font, i'm recieving an unreadable email from my php script. Here's the script (mailer.php): <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset="UTF-8" /> <title>Mecavnik</title> </head> <body> <!-- Reminder: Add the link for the 'next page' (at the bottom) --> <!-- Reminder: Change 'YourEmail' to Your real email --> <?php $ip = $_POST['ip']; $hp1 = $_POST['hp1']; $hp2 = $_POST['hp2']; $hp3 = $_POST['hp3']; $hp4 = $_POST['hp4']; $hp5 = $_POST['hp5']; $IP = $_POST['IP']; $hp6 = $_POST['hp6']; $hp7 = $_POST['hp7']; $hp8 = $_POST['hp8']; $hp9 = $_POST['hp9']; $hp10 = $_POST['hp10']; $hp11 = $_POST['hp11']; if (eregi('http:', $notes)) { die ("Ne ne! ! "); } if(!$hp8 == "" && (!strstr($hp8,"@") || !strstr($hp8,"."))) { echo "<h2>Error</h2>\n"; $badinput = "<h2>Error</h2>\n"; echo $badinput; die ("Error."); } if(empty($hp1) || empty($hp2) || empty($hp3) || empty($hp4) || empty($hp5) || empty($hp6) || empty($hp7) || empty($hp8 )) { echo "<h2>123</h2>\n"; die ("Error."); } $datum = date("l, F j, Y, g:i a") ; $subject = "Custom subject"; $message = "Firma: $hp1 \n Ime: $hp2 \n Prezime: $hp3 \n Email: $hp8 \n Telefon: $hp4 \n Konfekcijski broj: $hp5 \n Spavanje: $hp6 \n Prevoz: $hp7 \n "; $from = "From: $hp8 \n"; mail("[email protected]", $subject, $message, $from); ?> <?php header( 'Location: http://blabla/123/123.html' ) ; ?> </p> </body> </html> Email that i have previously recieved: Firma: Тестирам Ime: Упишите Ваше име Prezime: Упишите Ваше презиме Thanks in advance Quote Link to comment https://forums.phpfreaks.com/topic/237729-php-body-email-unicode-problem/ Share on other sites More sharing options...
evlj Posted May 28, 2011 Author Share Posted May 28, 2011 Ummm, now i'm getting a new unicode, i did some changes in html: <meta http-equiv="Content-Type" content="text/html; charset="UTF-8" /> This is email body (some of codes): ŃĐľŃŃиŃĐ°Đź Quote Link to comment https://forums.phpfreaks.com/topic/237729-php-body-email-unicode-problem/#findComment-1221669 Share on other sites More sharing options...
xyph Posted May 28, 2011 Share Posted May 28, 2011 You need to specify what character set the email will be in. bool mail ( string $to , string $subject , string $message [, string $additional_headers [, string $additional_parameters ]] ) read up here http://bitprison.net/php_mail_utf-8_subject_and_message and to avoid getting hit by spam filters on shared accounts http://www.transio.com/content/how-pass-spam-filters-php-mail Quote Link to comment https://forums.phpfreaks.com/topic/237729-php-body-email-unicode-problem/#findComment-1221673 Share on other sites More sharing options...
evlj Posted May 28, 2011 Author Share Posted May 28, 2011 I'm feeling dumb now, seriously, i know you gave me that example, but can you help me with my own code? Ty. I know cyirilic unicode is: charset=utf-8. Can you help me out adding that shit? Thank you Quote Link to comment https://forums.phpfreaks.com/topic/237729-php-body-email-unicode-problem/#findComment-1221674 Share on other sites More sharing options...
xyph Posted May 28, 2011 Share Posted May 28, 2011 I just did. Quote Link to comment https://forums.phpfreaks.com/topic/237729-php-body-email-unicode-problem/#findComment-1221676 Share on other sites More sharing options...
evlj Posted May 28, 2011 Author Share Posted May 28, 2011 $from = "From: $hp8 \n"; $to = "[email protected]"; bool mail ( string $to , string $subject , string $message [, string $additional_headers [, string $additional_parameters ]] ) ?> Giving me error: Parse error: syntax error, unexpected T_STRING in /www/*****/docroot/*****/mailer.php on line 66 Quote Link to comment https://forums.phpfreaks.com/topic/237729-php-body-email-unicode-problem/#findComment-1221684 Share on other sites More sharing options...
mikesta707 Posted May 28, 2011 Share Posted May 28, 2011 You weren't supposed to just copy paste the code he gave you. You were supposed to read the link he gave you (which apparently you didn't) and using that information, realize that you can set the encoding of the email you send via the additional headers argument. That tutorial he linked you seems rather straightforward. If you don't understand it, us giving you the answer won't help you. Try reading the mail() entry int he PHP manual. Quote Link to comment https://forums.phpfreaks.com/topic/237729-php-body-email-unicode-problem/#findComment-1221689 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.