我有以下代码使用 mail() 函数发送消息。一切正常,除了每行末尾的换行符似乎不起作用。如您所见,我正在使用“ \r\n ”,希望这会给我一个换行符,但我没有添加它<br>
来获得换行符,但我宁愿不使用它,以防有人没有HTML 电子邮件客户端。
<?php
$to = 'user@example.com'; // Was a valid e-Mail address, see comment below
$name = $_REQUEST['name'] ;
$email = $_REQUEST['email'] ;
$subject = $_REQUEST['subject'] ;
$message = $_REQUEST['message'] ;
$content = 'Name: '.$name."\r\n";
$content .= 'Email: '.$email."\r\n";
$content .= 'Subject: '.$subject."\r\n";
$content .= 'Message: '.$message."\r\n";
$headers = 'MIME-Version: 1.0' ."\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' ."\r\n";
// Additional headers
$headers .= 'To: iVEC Help <help@ivec.com>'. "\r\n";
$headers .= 'From: '.$name.' <'.$email.'>' . "\r\n";
mail( $to, $subject, $content, $headers);
?>
<p> You sent it ... good work buddy </p>
<p> <?php '$name' ?> </p>