这是我在php mail中的代码:
<?php
include_once("Mail.php");
$From = $_POST['enquiryemail'];
$To = $row2['email'];
$Subject = "An enquiry";
$Message = "This enquiry is created by: ".$_POST['enquiryname']."\r\nOrganization: ".$row['orgname']."\r\n Telephone Number: ".$_POST['telenum']."\r\nE-mail address: ".$_POST['enquiryemail']."\r\nMessage: ".$_POST['detail'];
address: ".$_POST['enquiryemail']."\r\nMessage: ".$_POST['detail'];
$Host = "smtp.test.com";
$Username = "";
$Password = "";
$Headers = array ('From' => $From, 'To' => $To, 'Subject' => $Subject);
$SMTP = Mail::factory('smtp', array ('host' => $Host, 'auth' => false,
'username' => $Username, 'password' => $Password));
$mail = $SMTP->send($To, $Headers, $Message);
这是&#34; \ r \ n&#34;不适用于中间的2行:
此查询由以下内容创建:测试 组织:测试电话号码:123456电子邮件地址:test@hotmail.com 消息:测试
知道怎么做才有效吗?感谢。
答案 0 :(得分:1)
您需要专门将内容类型声明为 html 以使用html语句
$message_string = "\r\n";
$message_string .= 'Content-Type: text/html; charset=ISO-8859-1"';
$message_string .= "\r\n";
$message_string .= $Message;
现在你的休息语句将生效。
答案 1 :(得分:-2)
您需要<br>
而不是\r\n
,因为您的内容类型是text / html。
同样的问题:link