2012-09-14 30 views
-5

试图让这个我可以在电子邮件标题中使用php include吗?

$headers = 'MIME-Version: 1.0' . "\r\n"; 
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; 
$headers .= 'From: $sales_rep_name <$sales_rep>' . "\r\n"; 
mail($to,$subject,$message,$headers); 

工作,这

//SET UP INFORMATION GOES HERE 
############################################################################ 
$sales_rep_name="Tommy"; 
$sales_rep="[email protected]"; 

,但它不工作。有任何想法吗?

+1

串“不工作”是不是在PHP内置的错误消息。 – 2012-09-14 19:58:51

+1

“不工作”是无用的诊断。我们的反应也可能是“好的,也许你没有足够的支付”。 –

+1

OP:请参阅http://emclstcd.tk获取进一步解释(其他人)。 – 2012-09-14 20:04:34

回答

4

你需要双引号,以获得变量的字符串内插:

$headers .= "From: $sales_rep_name <$sales_rep>" . "\r\n"; 
      ^        ^
+0

谢谢!就是这样。 – Tommy

相关问题