我使用php的mail()函数发送电子邮件。我的代码如下:在php mail()中添加字符串“1”
$to = [email protected];
$subject = "Subject of email";
ob_start();
echo include('emailcontent.php');
$message = ob_get_contents();
ob_end_clean();
$headers =
'From: Email <[email protected]>' . "\r\n" .
'Reply-To: Email <[email protected]>' . "\r\n" .
"Content-type:text/html;charset=UTF-8" . "\r\n" .
"MIME-Version: 1.0" . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);
由于某些原因,字符串“1”被添加在消息的末尾。这发生在include('emailcontent.php')中,因为如果在包含之后向消息添加另一个字符串,那么在添加之前添加“1”。
在emailcontent.php中不是1或任何。
完善和感谢您的解释。没有想到这一点。 – Nijn 2014-09-01 07:45:25