$mail_body = '<html>
<body style="background-color:#CCC; color:#000; font-family: Arial, Helvetica, sans-serif; line-height:1.8em;">
<h3><a href="http://www.grillontherock.com"><img src="http://i.imgur.com/OODKT9h.png" alt="GR" width="194" height="123" border="0"></a>
</h3>
<p>Hello ' . $name . ',</p>
<p>You can make this out to be just like most any web page or design format you require using HTML and CSS.</p>
<p>Grill on the Rock </p>
<hr>
<p>To opt out of receiving this newsletter, <a href="http://grillontherock.x10host.com/email/optout.php?e=' . $email . '">click here</a> and we will remove you from the listing immediately.</p>
</body>
</html>';
$to = "$email";
$subject = "Example Grill on the Rock Email";
$from="[email protected]";
$mail_result = mail($to, $subject, $mail_body, "From:".$from);
}
if($mail_result){
echo "Email has been sent successfully";
}
我有用php和html發送郵件的問題。php的郵件語法錯誤
此代碼工作完全正常,但我收到的電子郵件是
但是當我使用的HTML文件PHP代碼灰色雙引號因故。
$mail_body = "<html>
<body style="background-color:#CCC; color:#000; font-family: Arial, Helvetica, sans-serif; line-height:1.8em;">
<h3><a href="http://www.grillontherock.com"><img src="http://i.imgur.com/OODKT9h.png" alt="GR" width="194" height="123" border="0"></a>
</h3>
<p>Hello ' . $name . ',</p>
<p>You can make this out to be just like most any web page or design format you require using HTML and CSS.</p>
<p>Grill on the Rock </p>
<hr>
<p>To opt out of receiving this newsletter, <a href="http://grillontherock.x10host.com/email/optout.php?e=' . $email . '">click here</a> and we will remove you from the listing immediately.</p>
</body>
</html>";
$to = "$email";
$subject = "Example Grill on the Rock Email";
$from="[email protected]";
$mail_result = mail($to, $subject, $mail_body, "From:".$from);
}
if($mail_result){
echo "Email has been sent successfully";
}
有點新的PHP和HTML,我目前找不到類似的問題。
此外,是否有可能將電子郵件作爲HTML表單,並通過發送PHP文件將該HTML?
丹尼不是附加截圖,添加相關的代碼片段。他們會對社區更有幫助,以幫助您。 – NSNoob
刪除代碼圖片。請使用輸入的代碼來尋求幫助。 –
把你的代碼,而不是屏幕截圖丹尼..如果有人想幫他,他可以至少嘗試複製你的代碼..... – rahul