我試圖發送格式的電子郵件與PHP SMTP認證,但由於某種原因(S)\n
,\r\n
和PHP_EOL
無法格式化的消息,因此一切都出現在一行格式的電子郵件。如何使用SMTP
下面是我已經試過
$order .= "Title : {$title}" . PHP_EOL
."Author : {$author}" . PHP_EOL
."ISBN : {$isbn}" . PHP_EOL
."Publisher : {$publisher}" . PHP_EOL
."Supplier : {$supplier}\n
Quantity : {$qty}\r\n
變量$order
包含電子郵件的正文。 這是我sendMail()
功能的一部分
$from = "{$sender_name} <{$sender}>";
$to = $reciever." <$email>";
$subject = $subj;
$body = $msg;
$host = "mail.thekingsbooks.com";
$username = "[email protected]";
$password = "password";
$headers = array(
'From' => $from,
'To' => $to,
'Subject' => $subject
);
$smtp = Mail::factory(
'smtp',
array(
'host' => $host,
'auth' => true,
username => $username,
password => $password
)
);
$mail = $smtp->send($to, $headers, $body);
已發送的郵件看起來像這樣
Ordered items\r\nTitle : A Retreat With Pope John Paul II: Be Not Afraid (Retreat With-- Series)\r\nAuthor : \r\nISBN : 0867164204\r\nPublisher : \r\nSupplier : \r\n\r\n Quantity : 6\r\n\r\n
如何在電子郵件正文格式的任何建議?謝謝
我發郵件給Gmail,我沒有使用Outlook。 – Chibuzo