0

嗨,需要一些邮寄方面的帮助。我正在尝试将此变量的内容插入到字符串中以作为电子邮件发送,还需要添加换行符。还需要将 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);     
4

2 回答 2

1

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

试试这个。用户名和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); 
于 2013-08-15T00:25:29.153 回答
1

您缺少分号之前$email_to会导致语法错误。

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

于 2013-08-14T23:07:46.527 回答