Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New Coder
    Join Date
    Nov 2010
    Location
    Australia
    Posts
    20
    Thanks
    0
    Thanked 0 Times in 0 Posts

    mail.php file does not support Russian characters

    How can i make the mail.php file below work with russian characters?

    <?
    $name=$_POST['name'];
    $email=$_POST['email'];
    $phone=$_POST['phone'];
    $city=$_POST['city'];
    $message=$_POST['message'];
    $ToEmail = "xxxxxxxxxxxxxxxx@usa.net";
    $ToSubject = "Message from your site";
    $EmailBody = "Name: $name\n
    Email: $email\n
    Phone: $phone\n
    City: $city\n
    Message: $message\n";
    $Message = $EmailBody;
    $headers .= "Content-type: text; charset=iso-8859-1\r\n";
    $headers .= "From:".$name." / ".$email."\r\n";

    mail($ToEmail,$ToSubject,$Message, $headers);
    ?>

    THanks

  • #2
    New Coder
    Join Date
    Nov 2010
    Location
    Australia
    Posts
    20
    Thanks
    0
    Thanked 0 Times in 0 Posts
    any help would be appreciated
    Australian Web Designer experienced in designing Flash Templates , Photography Flash Templates , and HTML Templates.

  • #3
    Regular Coder low tech's Avatar
    Join Date
    Dec 2009
    Posts
    852
    Thanks
    173
    Thanked 94 Times in 94 Posts
    Hi

    I'm not a pro coder --- but I have had similar problem with Chinese

    anyway you could try to change your charset

    charset=utf8

  • #4
    New to the CF scene
    Join Date
    Nov 2010
    Posts
    6
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Add this to your <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    With the iso for russia. iso-8859-1 is for swedish.

  • #5
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,987
    Thanks
    4
    Thanked 2,660 Times in 2,629 Posts
    The meta won't work with a mail command; that one may work with the display though. Generally I find I need to push an actual content header from PHP to get it to understand >.<
    The charset change on the mail header should do the trick. Though I recall quite a ways back someone posting some problems that ended up being an issue with their webhost itself and not PHP.

    I can't wait for PHP 6 when it should support native unicode.

    Edit:
    Actually, with the meta I think I got what you mean there. It *may* work in the HTML processing from the client itself. But I have a feeling that the transfer will stomp it when the charset itself is incorrect.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 

  • #6
    New Coder
    Join Date
    Nov 2010
    Location
    Australia
    Posts
    20
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks, for all the advice, after some testing I got it working

    Below the modified and working code
    Note that you must save the mail.php file as UTF-8 , which can be done in notepad.

    To get the Russian text working i needed to change the charset to UTF-8

    <?
    $name=$_POST['name'];
    $email=$_POST['email'];
    $phone=$_POST['phone'];
    $city=$_POST['city'];
    $message=$_POST['message'];

    $ToEmail = "aaaa@xxxx.com";
    $ToSubject = "Message from your site";

    $EmailBody = "Name: $name\n
    Email: $email\n
    Phone: $phone\n
    City: $city\n
    Message: $message\n";

    $Message = $EmailBody;


    $headers .= "Content-type: text; charset=UTF-8\r\n";
    $headers .= "From:".$name." / ".$email."\r\n";

    mail($ToEmail,$ToSubject,$Message, $headers);

    ?>
    Australian Web Designer experienced in designing Flash Templates , Photography Flash Templates , and HTML Templates.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •