我一直在寻找大约一个小时,谷歌不是我的朋友。我已经改变了我的代码,添加\ n \ r,添加纯文本格式,HTML格式...PHP新行将不打印
的电子邮件打印成这样:
Below is the site survey information for test Restaurant Name: test Contact Name: test Walk-Thru Contact Name: test Site Surveyor: Brandon Projected Install Date: test Projected Opening Date: test Projected Completion Date: test
Item(s) Needed: test
Priority Level: Necessary for Install
Item(s) Needed:
Priority Level: Necessary for Install
Item(s) Needed:
Priority Level: Necessary for Install
只有前几行印刷在一起,但是完成日期之后的所有内容都是以新行打印。以下是目前为止的消息代码:
//Prepare content
$subject = "Site Survey Information";
$from_header = "From: $formval_RestaurantName";
$headers .= "Content-type: textrn";
$to = "$formval_receiver";
$contents .= "Below is the site survey information for $formval_RestaurantName\r\n";
$contents .= "Restaurant Name: $formval_RestaurantName\r\n";
$contents .= "Contact Name: $formval_ContactName\r\n";
$contents .= "Walk-Thru Contact Name: $formval_walkthru\r\n";
$contents .= "Site Surveyor: $formval_surveyor\r\n";
$contents .= "Projected Install Date: $formval_install\r\n";
$contents .= "Projected Opening Date: $formval_open\r\n";
$contents .= "Projected Completion Date: $formval_finish\r\n";
$contents .= "Item(s) Needed: $formval_items1\r\n";
$contents .= "Priority Level: $formval_priority_1\r\n";
$contents .= "Item(s) Needed: $formval_items2\r\n";
$contents .= "Priority Level: $formval_priority_2\r\n";
$contents .= "Item(s) Needed: $formval_items3\r\n";
$contents .= "Priority Level: $formval_priority_3\r\n";
$contents .= "Item(s) Needed: $formval_items4\r\n";
$contents .= "Priority Level: $formval_priority_4\r\n";
$contents .= "Item(s) Needed: $formval_items5\r\n";
$contents .= "Priority Level: $formval_priority_5\r\n";
$contents .= "Item(s) Needed: $formval_items6\r\n";
$contents .= "Priority Level: $formval_priority_6\r\n";
$contents .= "Item(s) Needed: $formval_items7\r\n";
$contents .= "Priority Level: $formval_priority_7\r\n";
$contents .= "Item(s) Needed: $formval_items8\r\n";
$contents .= "Priority Level: $formval_priority_8\r\n";
$contents .= "Item(s) Needed: $formval_items9\r\n";
$contents .= "Priority Level: $formval_priority_9\r\n";
$contents .= "Item(s) Needed: $formval_items10\r\n";
$contents .= "Priority Level: $formval_priority_10\r\n";
$contents .= "Item(s) Needed: $formval_items11\r\n";
$contents .= "Priority Level: $formval_priority_11\r\n";
$contents .= "Item(s) Needed: $formval_items12\r\n";
$contents .= "Priority Level: $formval_priority_12\r\n";
$contents .= "Item(s) Needed: $formval_items13\r\n";
$contents .= "Priority Level: $formval_priority_13\r\n";
$contents .= "Item(s) Needed: $formval_items14\r\n";
$contents .= "Priority Level: $formval_priority_14\r\n";
$contents .= "Item(s) Needed: $formval_items15\r\n";
$contents .= "Priority Level: $formval_priority_15\r\n";
我还能做些什么来让它打印新行?
什么是Content-type中的“textrn”? – allaire 2012-03-21 19:43:52
你看到哪个电子邮件客户端没有打印新行,或者你只是在浏览器中查看它?虽然电子邮件HTML通常是非常挑剔的,但基础知识(如'
')仍然在全面工作。对于每次需要文本以新行开始时,您应告诉PHP打印一个网站上看到的'
' – Mattygabe 2012-03-21 19:45:15
,有人说会将其转换为纯文本电子邮件。由于我一直在研究这个代码一个月,但它还没有真正起作用,所以我已经迫不及待地尝试了任何东西。 – user1284324 2012-03-21 19:45:44