Note that there are some explanatory texts on larger screens.

plurals
  1. POEncoding PHP to send mails in other languege
    text
    copied!<p>I want to encode my php sending form in my language. What is wrong with the code? I have added the content-type in the $headers at the end... It is not the whole file, there is also HTML after the PHP, but did not let me to post it</p> <pre><code>&lt;?php if(isset($_POST['email'])) { // EDIT THE 2 LINES BELOW AS REQUIRED $email_to = "gancho_lambev@abv.bg"; $email_subject = "Contact Form..."; function died($error) { // your error code can go here echo "We are very sorry, but there were error(s) found with the form your submitted. "; echo "These errors appear below.&lt;br /&gt;&lt;br /&gt;"; echo $error."&lt;br /&gt;&lt;br /&gt;"; echo "Please go back and fix these errors.&lt;br /&gt;&lt;br /&gt;"; die(); } // validation expected data exists if(!isset($_POST['name']) || !isset($_POST['email']) || !isset($_POST['comments'])) { died('We are sorry, but there appears to be a problem with the form your submitted.'); } $name = $_POST['name']; // required $email_from = $_POST['email']; // required $comments = $_POST['comments']; // required function clean_string($string) { $bad = array("content-type","bcc:","to:","cc:","href"); return str_replace($bad,"",$string); } $email_message .= "Name: ".clean_string($name)."\n"; $email_message .= "Email: ".clean_string($email_from)."\n"; $email_message .= "Comments: ".clean_string($comments)."\n"; // create email headers $headers .= 'Content-type: text/plain; charset=windows-1251' . "\r\n"; $headers = 'From: '.$email_from."\r\n". 'Reply-To: '.$email_from."\r\n" . 'X-Mailer: PHP/' . phpversion(); @mail($email_to, $email_subject, $email_message, $headers); ;} ?&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload