【发布时间】:2017-08-28 19:35:46
【问题描述】:
我有这个 send_mail.php 文件。我正在尝试回显一些插入表单的字段,但我不能使用回显功能。我做错了什么?
<?php
$date = $_POST['date'];
$full_name = $_POST['full_name'];
$biz_name = $_POST['biz_name'];
$activity = $_POST['activity'];
$afm = $_POST['afm'];
$phone = $_POST['phone'];
$fax = $_POST['fax'];
$mobile = $_POST['mobile'];
$address = $_POST['address'];
$city = $_POST['website'];
$email = $_POST['email'];
$discount = $_POST['discount'];
$payment_amount = $_POST['payment_amount'];
$seller_name = $_POST['seller_name'];
$to = $email;
$subject = "Welcome to our site!";
$htmlContent = file_get_contents("email_template.html");
// Set content-type header for sending HTML email
$headers = "MIME-Version: 1.0" . "\r\n";
$headers = "Content-type: text/html; charset=UTF-8" . "\r\n";
// Send email
if(mail($to,$subject,$htmlContent,$headers)):
$successMsg = 'Mail sending successful.';
else:
$errorMsg = 'Oops! Something went wrong.';
endif;
?>
我的 email_template.html 看起来像这样:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Welcome to our site</title>
<head/>
<body>
<h1> Welcome <?php echo $full_name; ?> </h1>
...
</body>
</html>
我是网络开发的新手,所以要温柔! :P
【问题讨论】:
标签: php html email templates encoding