我已經通過這個線程在這裏工作: Sending HTML email from PHP格式HTML與PHP郵件
在過去的5小時,由於某種原因,不能讓我的PHP生成HTML的郵件。
這是我有:
// Construct Mail:
$message = "<html><body>Some text<br />New line<p>New para</p></body></html>";
// Send Mail:
$to = "$UserMail";
$subject = "[Skills Exchange Network] Event Created";
$header = 'MIME-Version: 1.0' . "\r\n";
$header .= 'Content-Type: text/html; charset=ISO-8859-1' . "\r\n";
$headers .= 'From: Skills Exchange Network <Mail Address is here>' . "\r\n";
$headers .= 'Cc: Skills Exchange Network <Mail Address is here>' . "\r\n";
$SendMail = mail($to,$subject,$message,$headers);
這是我收到:
從技能交換網RNCC:技能交換網絡RN
我真的不知所措...
下面是我現在擁有的:
// Construct Mail:
$message = "<html><body>Some text<br />New line<p>New para</p></body></html>";
// Send Mail:
$to = "$UserMail";
$subject = "[Skills Exchange Network] Event Created";
// To send HTML mail, the Content-type header must be set
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1" . "\r\n";
// Additional Headers:
$headers .= "From: Skills Exchange Network <[email protected]>" . "\r\n";
$headers .= "Cc: Skills Exchange Network <[email protected]>" . "\r\n";
$SendMail = mail($to, $subject, $message, $headers);
這裏就是我得到:
Subject: [Skills Exchange Network] Event Created
MIME-Version: 1.0rnContent-Type: text/html; charset=ISO-8859-1rnFrom: Skills Exchange Network <[email protected]>rnCc: Skills Exchange Network <[email protected]>rn
Message-Id: <[email protected]>
From: [email protected]
Date: Thu, 18 Jul 2013 10:13:08 -0500
X-Antivirus: AVG for E-mail 2013.0.3349 [3204/6500]
X-AVG-ID: ID58DD9571-36429B43
<html><body>Some text<br />New line<p>New para</p></body></html>
最好是使用表格進行電子郵件標記 – DarkBee
這是您收到的電子郵件正文還是這個主題? –
有兩件事情是錯誤的:標題和正文。我收到郵件,但標題格式不正確,HTML以純文本格式顯示。可能是因爲標題錯誤。 – Harlequin