2012-09-14 34 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

相關問題