TShopping
標題:
簡易留言板製作(發MAIL方式)
[打印本頁]
作者:
woff
時間:
2009-12-1 17:19
標題:
簡易留言板製作(發MAIL方式)
先寫一個表單
<?php
//如果壓"確認"鈕 送出
if (isset($_POST["send"])) {
//接收內容
$username = addslashes($_POST["username"]);
$content = addslashes($_POST["content"]);
//MAIL標頭檔UTF8格式
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=utf-8\r\n";
//MAIL資訊
$to=xxx@tshopping.com.tw;
$from="xxx@tshopping.com.tw";
//MIAL主題
$subject="tshopping有人留言給你嚕!";
$body="留言的是".$username."<br>內容是:".$content;
//送出郵件
if(mail($to,$subject,$body,$headers)) {
echo "郵件已寄出!\n";
} else {
echo "郵件寄送失敗!\n";
}
}
?>
<form name="form1" method="post" action="<?php exho $_SERVER[PHP_SELF]; ?>" >
<table width="400" border="0" align="center" cellpadding="0" cellspacing="0">
<tr class="trr" align="center">
<td height="20"><div align="center" class="style1">使用者名稱XXX:</div></td><td><input type="text" size="10" name="username"></td>
</tr>
<tr>
<td width="90" bgcolor="#FFFFFF"><div align="center">內容敘述:</div></td>
<td width="307" bgcolor="#FFFFFF"><div align="left">
<textarea name="content" colspan="20" rowspan="20"></textarea>
</div></td>
</tr>
<tr>
<td height="25" colspan="2"><div align="center">
<input type="submit" value="確認" class="buttoncss" name="send">
</div></td>
</tr>
</table>
</form>
複製代碼
作者:
bvbys
時間:
2012-7-24 01:10
好帖子,要頂!
歡迎光臨 TShopping (http://www.tshopping.com.tw/)
Powered by Discuz! X3.2