Jump to content

Recommended Posts

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: &#1058;&#1077;&#1089;&#1090;&#1080;&#1088;&#1072;&#1084; 

Ime: &#1059;&#1087;&#1080;&#1096;&#1080;&#1090;&#1077; &#1042;&#1072;&#1096;&#1077; &#1080;&#1084;&#1077; 

Prezime: &#1059;&#1087;&#1080;&#1096;&#1080;&#1090;&#1077; &#1042;&#1072;&#1096;&#1077; &#1087;&#1088;&#1077;&#1079;&#1080;&#1084;&#1077; 

 

Thanks in advance

Link to comment
https://forums.phpfreaks.com/topic/237729-php-body-email-unicode-problem/
Share on other sites

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

$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

 

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.