將smarty輸出的網頁用mail寄出
MAILcontact.html 的內容就是信件內容的格式
ob_start();
$tpl->assign("fromname", $fromname);
$tpl->assign("fromemail", $fromemail);
$tpl->assign("tel", $tel);
$tpl->assign("msg", $msg);
$tpl->display("templates/MAILcontact.html");
$sendmsg = ob_get_contents(); //取得smarty產生的html語法
ob_end_clean();
$sendsubject=$subject." from $fromname";
$harder="From: $fromemail\nReply-To: $fromemail\nX-Mailer: PHP/";
$harder .= "MIME-Version: 1.0\nContent-Type: text/html ;charset=big5";
if (mail($email, $sendsubject, $sendmsg, $harder)) {
alert("信件寄送完成!","index.php"); //自定的function
}
- Sep 25 Fri 2009 09:24
-
[程式] php - 將smarty輸出的網頁mail寄出
About Me
Blog Rss
Photo
Guestbook
請先 登入 以發表留言。