1

I'm trying to solve the problem of reading special characters, (plus I cant get it on one of the Gmail) I get something like this "לדו×" and this "Ч“Ч•Чђ\"ЧњЧ“Ч•" sent from my WP blog I've tried all ways which were explained on Stack Overflow, but the questions might be specific, which hadn't work for me. I wont use any plugin for that, so my preferred code is here:

<?php 
   .....................
        if(!isset($hasError)) {


        $emailTo = 'asdasdasd@mail.ru,  asdasdasd@gmail.com, info@travel-asdasdasd.co.il ' ;
            $subject = $_POST['subject'];
                $comments= $_POST['comments'];
                $dge= $_POST['dge'];
                $tve= $_POST['tve'];
                $weli= $_POST['weli'];
        $sendCopy = trim($_POST['sendCopy']);
        $body = "Name: $ContactName \n\nEmail: $email \n\nComments: $comments \n\n Subject :$subject \n\n Number: $phone \n\n $dge / $tve /$weli";

        mail($emailTo, ": הודעה" , $body, "Travel-Georgia" );
        ///////////////// 
        // set our boolean completion value to TRUE
        $emailSent = true;
    }
}    
?>   
    .......

                    <form id="contact-us"  method="post" accept-charset="utf-8"> .......</form>
  • You have to set the encoding information for the message, have a look at the mail function in PHP.net there you will find very useful information, specially on the comments area. – PatomaS Mar 21 '14 at 0:53
  • Also, make sure you Form submits UTF-8 data. – phoops Mar 21 '14 at 8:37
2

You have to encode your E-Mail contents using proper E-Mail encoding methods before they show up correctly in E-Mails.

If I were you, I would use wp_mail() function inside WordPress to send the E-Mails. I don't know if it does all the required encodings though.

Another alternative is to use SwiftMailer to send the E-Mails. It certainly takes care of all the encoding and other duties needed to send properly encoded E-Mail.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.