我的代碼從逗號分隔的文件中讀取行(電子郵件消息)併發送電子郵件。它運作良好,我用\ r \ n \爲新行發送郵件時,用戶接收器\ r \ n \而不是新行。php解析來自變量的新行
在emailmessages.csv它會讀取
"from","to","subject","message"
"[email protected]","[email protected]","the subject","message is this new line \r\n endline"
PHP:代碼
$filename = "emailmessages.csv";
$csvArray = ImportCSV2Array($filename);
foreach ($csvArray as $row) {
$to = $row['to'];
$from = $row['from'];
$subject = $row['subject'];
$message = $row['message'];
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type: text/plain; charset=iso-8859-1" . "\r\n";
$headers .= "From: $from" . "\r\n";
mail($to, $subject, $message, $headers);
}
請問爆炸命令幫我
你得到一些錯誤? – sensorario
請發佈標題變量 –
不,我得到整個電子郵件完全一樣從csv輸入,\ r \ n \未在電子郵件中轉換 –