这是我的代码:
$body = "Name:{$name}".PHP_EOL;
$body .= "Phone:".$phone.PHP_EOL;
$body .= "Email:".$email."\n\n";
$body .= "Comments:".$comments."\n\n";
$headers = 'From: MAILER <'.$emailTo.'>' . "\r\n" . 'Reply-To: '. $email."\r\n";
$headers .= "Content-Type: text/html; charset=UTF-8";
mail($emailTo, "New message", $body, $headers);
如您所见,我尝试使用 \r\n\、\n\n、PHP_EOL 等...唯一有效的方法是删除“内容类型”标头。有人知道为什么会这样吗?!