我试图从我的新php网站发送邮件。邮件正在传递,但我没有正确地获取主题和From字段。
<?php
define('incall', true);
if(!@include_once('config.php'))
{
header('HTTP/1.0 404 Not Found');
exit;
}
$to=$_POST['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.');
?>
请你检查并回答?
答案 0 :(得分:1)
你确定这不是一个错字吗?
$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";
<强> $主题= $ _ POST [ '主题'] 强>
if(mail($to, $subject, $message, $headers))header("location:mailsent.php")
;
半结肠缺失
答案 1 :(得分:0)
我为此建了一个类 - 你可以在: http://www.kaiesh.com/65/sending-html-composite-email-in-php-using-objects
希望有所帮助!
答案 2 :(得分:0)
您是否尝试在$ headers字符串中仅使用"\n"
代替"\r\n"
?