Mobile app version of vmapp.org
Login or Join
Sarah324

: UTF-8 charset doesn't work for PHP mail form 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 "לדו×"

@Sarah324

Posted in: #Email #Forms #Php #Post

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 nnEmail: $email nnComments: $comments nn Subject :$subject nn Number: $phone nn $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>

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Sarah324

1 Comments

Sorted by latest first Latest Oldest Best

 

@Jessie594

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.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme