我想制作一个自动化的 html/css 电子邮件,我在其中使用了该mail()功能,但它显示为代码我已经在标题中提供了文档类型和内容,但它仍然显示为代码:我还将提供 doctype 的标题连接到标题中,但它仍然不起作用。这是我的代码:<?php function clean_string($string) { $bad = array("content-type","bcc:","to:","cc:","href"); return str_replace($bad,"",$string); }$email_from = "info@domain.com"; $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@gmail.com";$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@gmail.com";$headers=$headers1.$headers2;if (mail($to,$subject,$txt,$headers)){ //echo "Thank You for contacting us, we will get back to you soon";}?>
- 2 回答
- 0 关注
- 276 浏览
添加回答
举报
0/150
提交
取消