我想制作一個自動化的 html/css 電子郵件,我在其中使用了該mail()功能,但它顯示為代碼我已經在標題中提供了文檔類型和內容,但它仍然顯示為代碼:我還將提供 doctype 的標題連接到標題中,但它仍然不起作用。這是我的代碼:<?php function clean_string($string) { $bad = array("content-type","bcc:","to:","cc:","href"); return str_replace($bad,"",$string); }$email_from = "[email protected]"; $email_message = "<html xmlns='http://www.w3.org/1999/xhtml' xmlns:o='urn:schemas-microsoft-com:office:office' xmlns:v='urn:schemas-microsoft-com:vml' style='line-height: inherit;'><head><meta content='text/html; charset=utf-8' http-equiv='Content-Type'><meta content='width=device-width' name='viewport'><meta content='IE=edge' http-equiv='X-UA-Compatible'><title></title><style id='media-query' type='text/css'>@media only screen and (min-width: 670px) { .block-grid { width: 650px !important; } .desktop_hide { display: block !important; max-height: none !important; }}</style></head><body class='clean-body' style='line-height: inherit; margin: 0; padding: 0; -webkit-text-size-adjust: 100%; background-color: #FFFFFF;'><style id='media-query-bodytag' type='text/css'></tr></tbody></table></</table></body></html>";$to = "[email protected]";$subject = "Enquiry";$txt = $email_message;$headers1="<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional //EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>";$headers2 = "From:". $email_from . "\r\n" ."CC: [email protected]";$headers=$headers1.$headers2;if (mail($to,$subject,$txt,$headers)){ //echo "Thank You for contacting us, we will get back to you soon";}?>
- 2 回答
- 0 關注
- 306 瀏覽
添加回答
舉報
0/150
提交
取消