如何在HTML FORM中包含$ headres以显示捷克语言字符(拉丁扩展)

时间:2018-11-07 08:33:23

标签: forms

我有这个HTML表单,该表单调用php文件contactform.php

我包括了这些标题,但在发送的电子邮件中仍然出现错误的字符。

$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=UTF-8\r\n";
$headers .= "Content-Transfer-Encoding: 8bit\r\n";

这是php文件:

<?php
error_reporting(0);

$email_it_to = “name@domain.cz";

$error_message = "Please complete the form first";

$rnd=$_POST['rnd'];
$name=$_POST['name'];
$email=$_POST['email'];
$phone=$_POST['phone'];
$subject=$_POST['subject'];
$body=$_POST['body'];

if(!isset($rnd) || !isset($name) || !isset($email) || !isset ($phone) || !isset($subject) || !isset($body)) {
echo $error_message;
die();
}

$subject = stripslashes($subject);
$email_from = $email;

$email_message = "Message submitted by '".stripslashes($name)."',  email:".$email_from;
$email_message .=" on ".date("d/m/Y")."\n\n";
$email_message .= stripslashes($body);
$email_message .="\n\n";

// Always set content-type when sending HTML email

$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-Type: text/html; charset=UTF-8". "\r\n";
$headers .= 'From: '.stripslashes($name);

// $headers .= 'From: <'.$email_from.'>' . "\r\n";

mail($email_it_to,$subject,$phone,$email_message,$headers);

?>

在发送表单时,我在弹出窗口确认以及电子邮件中收到错误的字符。

0 个答案:

没有答案