我一直在尝试在邮件正文中创建换行符,但它不起作用。正文中的所有文本都排成一行。
<?php
if ($_POST["email"]<>'') {
$ToEmail = 'demo@localhost.com';
$EmailSubject = 'Site contact form';
$header = "MIME-Version: 1.0" . "\r\n";
$header .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";
$header .= "From: ".$_POST["email"]."\r\n";
$header .= "Reply-To: ".$_POST["email"]."\r\n";
$message = "Name: ".$_POST["name"]."\r\n";
$message .= "Email: ".$_POST["email"]."\r\n";
$message .= "Comment: ".nl2br($_POST["comment"])."";
mail($ToEmail, $EmailSubject, $message, $header) or die ("Failure");
?>
Your message was sent
<?php
} else {
?>
Sorry message was not sent
<?php
};
?>