我已经查看了一些解决方案,但都没有奏效。
<?php
$name = $_POST['name'] . "<br>" ;
$email = $_POST['email'] . "/r/n";
$phone = $_POST['phone'] . "/r/n";
$message = $_POST['message'] . "/r/n";
$from = 'From: email@place.com';
$to = 'mail@otherplace.com';
$subject = 'subject here';
$body = "From: $name E-Mail: $email Phone: $phone $message"
?>
<?php
if ($_POST['submit']) {
if (mail ($to, $subject, $body, $from)) {
echo '<p>Your message has been sent</p>';
}else{
echo '<p>Something went wrong, go back and try again.</p>';
}
}
?>
这不仅在一行上显示所有内容,而且还显示 /r/n 和
标签,就好像它们只是文本一样。