2009-12-29 113 views
0

这里是我的代码....PHP的mail()报头问题

$subject = "This is Subject"; 
$headers .= 'Content-type: text/html; charset=iso-8859-1'; 
$to = '[email protected]'; 
$body = 'Mail Content Here';   
mail($to, $subject, $body, $headers); 

但是当我打开这个文件,它会发送一个邮件$to成功但错误的头....我的托管服务器的默认解决即mars.myhosting.com,而不是[email protected]我怎样才能解决这个问题

+0

您正在使用的连接符添加的“头”变量。变量的全部价值是什么?另外,您是否启用了邮件服务器上的跟踪,或者使用网络嗅探器来准确查看实际发送的内容? – atk 2009-12-29 06:56:54

回答

3

看看这个从php.net

$to  = '[email protected]'; 
$subject = 'the subject'; 
$message = 'hello'; 
$headers = 'From: Webmaster <[email protected]>' . "\r\n" . 
    'Reply-To: [email protected]' . "\r\n" . 
    'X-Mailer: PHP/' . phpversion(); 

mail($to, $subject, $message, $headers); 

从头部

+0

它应该发送一个html标题或不 – 2009-12-29 07:24:45