我想知道如何设置$ body =“部分的样式,以便我的电子邮件更易于阅读。
我已经尝试过添加标签或正文标签之类的东西,但它似乎都没有用,请帮我解决这个烦人的问题,
很多问候,
昆西
<?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";
$body = "
New Mail $name\n $email\n \n $message";
if ($_POST['submit']) {
if ($name != '' && $email != '') {
if ($human == '4') {
if (mail ($to, $subject, $body, $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>';
}
}
?>
答案 0 :(得分:0)
如果您只是使用CSS样式(如style =“correct-message”) - 这不起作用,您也应该在正文中添加样式定义,如下所示:
<style> .correct-message{font-weight:bold; color:red;}</style>