我一直在我的php脚本中使用mail()。但每当我发送邮件时,我都会收到此错误:
session_start():无法发送已发送的会话缓存限制器标头(输出从myfilepath / somefile.php开始:行号)
邮件未发送。我在var_dump(mail(to,subject,message))上得到了错误。这是我正在使用的代码:
<?php
$name=$_POST['wname'];
$no=$_POST['wno'];
$od=$_POST['wod'];
$to="some@domain.com";
$subject="Customer Details";
$message="Following are the details of the customer - NAME : '".$name."' CONTACT NO : '".$no."' ORGANIZATION & DESIGNATION : '".$od."'" ;
echo $message;
/*if( mail($to,$subject,$message,$headers))
echo "mail sent";
else
echo "mail not sent";*/
$result = mail($to,$subject,$message);
if (!$result) {
$errorMessage = error_get_last()['message'];
echo "<br>$errorMessage";
}
感谢。