Problem in mail() function
I have tried to send mail from my new php website. Mail is delivering but I'm not getting the subject and From fields correctly.
<?php
define('incall', true);
if(!@include_once('config.php'))
{
header('HTTP/1.0 404 Not Found');
exit;
}
$to=$_P开发者_如何学JAVAOST['to'];
$message = str_replace('{link}', $download_path.$_POST['filename'].'.mp3', $email_body);
$headers = "From: ".$emailfrom_name." <".$emailfrom_address.">\r\n"
."Return-Path: ".$emailfrom_address."\r\n";
$subject=$_POST['subject']
if(mail($to, $subject, $message, $headers))header("location:mailsent.php");
exit('Error! Can not be send.');
?>
Could you please check and answer ?
Are you sure this is not a typo ??
$message = str_replace('{link}', $download_path.$_POST['filename'].'.mp3', $email_body);
$headers = "From: ".$emailfrom_name." <".$emailfrom_address.">\r\n"
."Return-Path: ".$emailfrom_address."\r\n";
$subject=$_POST['subject']
if(mail($to, $subject, $message, $headers))header("location:mailsent.php")
;
semi colon missing
I built a class for this - you can get it at: http://www.kaiesh.com/65/sending-html-composite-email-in-php-using-objects
Hope that helps!
Did you try using just "\n"
instead of "\r\n"
in the $headers string?
精彩评论