我有一个表单数据发送到电子邮件的大问题。当我填写我的订单,在电子邮件,我得到:从UTF-8发送表单数据到电子邮件
VÄrdiņš:LA«VA,
代替Vārdiņš:利华
我想我已经定好了UTF- 8,但没有任何变化。谁能帮忙?
这里是我的orders.php
<?php
header('Content-Type: text/html; charset=utf-8');
mb_internal_encoding('UTF-8');
//subject and email variables//
$emailSubject = 'Pasūtījums no www.gramatina.lv';
$webMaster = '[email protected]';
//gathering data variables//
$type = $_POST['type'];
$typography = $_POST['typography'];
$spiral = $_POST['spiral'];
$color_name = $_POST['color_name'];
$nameYes = $_POST['nameYes'];
$unryu = $_POST['unryu'];
$nameU = $_POST['nameU'];
$shipping = $_POST['shipping'];
$totalPrice = $_POST['totalPrice'];
$first_name = $_POST['first_name'];
$last_name = $_POST['last_name'];
$email = $_POST['email'];
$telephone = $_POST['telephone'];
$address = $_POST['address'];
$comments = $_POST['comments'];
$other_color = $_POST['other_color'];
$body = <<<EOD
Grāmatas veids: $type
Krāsa: $typography, $spiral, $unryu, $other_color
Ar vai bez vārdiņa: $color_name
Vārdiņš: $nameYes, $nameU
Piegādes veids: $shipping
Cena: $totalPrice
Vārds, uzvārds: $first_name, $last_name
E-pasta adrese: $email
Telefona numurs: $telephone
Piegādes adrese: $address
Komentārs: $comments
EOD;
$header = "From: $email";
If($_POST){
mail($webMaster, $emailSubject, $body, $header);
header('Location: thank_you_order.html');
}
?>
这里的HTML页面标题:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>Mūsu mazuļa grāmatiņa</title>
</head>
<body>
<div id="form">
<form action="orders.php" method="post">
</div>
</body>
</html>
考虑使用这个类https://github.com/PHPMailer/PHPMailer发送相当好的邮件 –