我目前正在尝试对通过我自制的 php 联系表发送的传入电子邮件进行样式设置。
只有一个小问题,当我在收件箱中收到电子邮件时,html 显示为静态文本而不是代码。
谁能帮帮我?
<?php
$name = $_POST['name'];
$email = $_POST['email'];
$message = $_POST['message'];
$from = 'From: info@epicconcepts.nl';
$to = 'info@epicconcepts.nl';
$subject = 'Contact formulier bericht';
$human = $_POST['human'];
$headers = "From: " . strip_tags($_POST['req-email']) . "\r\n";
$headers .= "Reply-To: ". strip_tags($_POST['req-email']) . "\r\n";
$headers .= "CC: quincynorbert@live.nl\r\n";
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$message = '<!DOCTYPE html>
<html>
<head>
<style type="text/css">
body{background: #EDEBEA;}
#naam{background:#222222;border:4px solid #DDD;width:650px;}
#mail{background:#222222;border:4px solid #DDD;width:650px;}
#message{background:#222222;border:4px solid #DDD;width:650px;}
</style>
</head>
<body>
<div id="naam">'.$name.'</div>
<div id="mail">'.$email.'</div>
<div id="message">'.$message.'</div>
</body>
</html>';
if ($_POST['submit']) {
if ($name != '' && $email != '') {
if ($human == '4') {
if (mail ($to, $subject, $message, $from)) {
echo '<p class="correct-message">Your message has been sent!</p>';
} else {
echo '<p class="correct-message">Something went wrong, go back and try again!</p>';
}
} else if ($_POST['submit'] && $human != '4') {
echo '<p class="correct-message">You answered the anti-spam question incorrectly!</p>';
}
} else {
echo '<p class="correct-message">You need to fill in all required fields!</p>';
}
}
?>
感谢您提前