PHP字符串帮助邮件


PHP string help mail

我需要一些邮件帮助。我正在尝试将这个变量的内容插入到一个字符串中,以便作为电子邮件发送。还需要添加一个换行符。还需要将"From header"更改为"Procity",并且procitystaff@gmail.com

$claim_msg='Hey $claim_username, 'n The donator has cancelled your claimed item, but you got your          '    $email_to=$claim_email;
$template=$claim_msg;
$subject= "Claimed item canceled";
$headers = 'MIME-Version: 1.0' . "'r'n";
$headers .= 'Content-type: text/html; charset=iso-8859-1 '.' 'r'n';
$headers .= 'From: procitystaff@gmail.com'.' 'r'n';
$from='procitystaff@gmail.com';
mail($email_to,$subject,$template,$headers);     

$email_to前面缺少一个分号,这将导致语法错误。

在插入打印Hey $claim_username的php变量时,您还使用了单引号',而不是打印Hey JohnDoe的双引号"

下面代码的第一行末尾缺少分号。此外,我还使用了连接。

试试看。用户名和The donator之间将出现换行符。

示例:

嘿,约翰,
捐赠者已经取消了您的索赔项目,但您收到了

$claim_msg='Hey ' . $claim_username . ',' . "<br>'n" . 'The donator has cancelled your claimed item, but you got your';
$email_to=$claim_email;
$template=$claim_msg;
$subject= "Claimed item canceled";
$headers = 'MIME-Version: 1.0' . "'r'n";
$headers .= 'Content-type: text/html; charset=iso-8859-1 '.' 'r'n';
$headers .= 'From: Procity <procitystaff@gmail.com>' . "'r'n";
$from='procitystaff@gmail.com';
mail($email_to,$subject,$template,$headers);