2014-06-24 75 views
-1
$email="[email protected]"; 

$message= "CALLERS NAME: ".$values["CallName"]."\r\n"; 
$message="CALLERS STREET ADDRESS: ".$values["CallStNo"]."\r\n"; 
$message="STREET DIRECTION: ".$values["CallStDir"]."\r\n"; 
$message="CALLERS STREET NAME: ".$values["CallStreet"]."\r\n"; 
$message="ISSUE CALLER IS CALLING ABOUT: ".$values["CallIssue"]."\r\n"; 
$message="ADDITIONAL INFORMATION: ".$values["CallMisc"]."\r\n"; 
$message="CALLERS PHONE NUMBER: ".$values["CallPhone"]."\r\n"; 
$message="DATE OF CALL: ".$values["date"]."\r\n"; 
$message="PERSON WHO TOOK PHONE CALL: ".$values["dataentry"]."\r\n"; 
$message="CURRENT STATUS OF CALL: ".$values["status"]."\r\n"; 

$subject="Call from Citizen"; 

runner_mail(array('to' => $email, 'subject' => $subject, 
    'htmlbody' => $message, 'charset' => 'UTF-8')); 

當我建立它時,它只發送一封電子郵件與消息的最後一行$ message =「CURRENT STATUS OF CALL:」。$ values [「status」]。「\ r \ n「;正確的格式爲PHP html電子郵件

和值。

我是否需要將郵件包裝好才能獲得電子郵件中填寫的所有字段?

+1

在第一個'$ message ='使用'$ message。='之後。閱讀文檔:http://www.php.net//manual/en/language.operators.string.php – Joe

+0

你每次都覆蓋你的變量。 –

+2

對所有變量使用'$ message。=「...',除了第一個變量外,該點是一個連接字符 –

回答

0

您已設置並重置$message幾次。將第一個$message保留原樣(CALLERS名稱爲1)並將其設置爲$message .=

您還應該避免對變量和回顯使用引號,否則可能會重新打開變量的回顯呼叫。像這樣將變量調用改爲單引號。

$email="[email protected]"; 

$message = "CALLERS NAME: ".$values['CallName']."\r\n"; 
$message .="CALLERS STREET ADDRESS: ".$values['CallStNo']."\r\n"; 
$message .= "STREET DIRECTION: ".$values['CallStDir']."\r\n"; 
$message .= "CALLERS STREET NAME: ".$values['CallStreet']."\r\n"; 
$message .= "ISSUE CALLER IS CALLING ABOUT: ".$values['CallIssue']."\r\n"; 
$message .= "ADDITIONAL INFORMATION: ".$values['CallMisc']."\r\n"; 
$message .= "CALLERS PHONE NUMBER: ".$values['CallPhone']."\r\n"; 
$message .= "DATE OF CALL: ".$values['date']."\r\n"; 
$message .= "PERSON WHO TOOK PHONE CALL: ".$values['dataentry']."\r\n"; 
$message .= "CURRENT STATUS OF CALL: ".$values['status']."\r\n"; 

$subject="Call from Citizen"; 

runner_mail(array('to' => $email, 'subject' => $subject, 
    'htmlbody' => $message, 'charset' => 'UTF-8')); 
+0

感謝您的快速回復,這很好用,我也必須缺少其他的東西。數據現在在電子郵件中,但是\ r \ n沒有放置我認爲是回車的東西。我希望「CALLERS NAME ::」是粗體,然後是數據,然後是回車,然後是下一行數據,如果有意義 – user3325169

+0

@ user3325169在發送HTML電子郵件時,您可以使用
而不是\ r \ n – CmdrSharp