|
|
|
Form send mail ทำอย่างไร ให้ ใช้ <br>ได้ครับ Form send mail ทำอย่างไร |
|
|
|
|
|
|
|
ดูนี่เป็นตัวอย่างนะครับ
$header.= "Content-type: text/html; charset=windows-874\n";
$header.="from: [email protected]";
$subject="เพื่อนของคุณได้แนะนำเว็บไซต์ www.ThaiCreate.com";
|
|
|
|
|
Date :
24 พ.ค. 2548 11:54:48 |
By :
@W_IN |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Code (phpSendMailContactForm.html)
<html>
<head>
<title>ThaiCreate.Com PHP Sending Email</title>
</head>
<body>
<form action="phpSendMailContactForm.php" method="post" name="frmMain">
<table width="343" border="1">
<tr>
<td>To</td>
<td><input name="txtTo" type="text" id="txtTo"></td>
</tr>
<tr>
<td>Subject</td>
<td><input name="txtSubject" type="text" id="txtSubject"></td>
</tr>
<tr>
<td>Description</td>
<td><textarea name="txtDescription" cols="30" rows="4" id="txtDescription"></textarea></td>
</tr>
<tr>
<td>Form Name</td>
<td><input name="txtFormName" type="text"></td>
</tr>
<tr>
<tr>
<td>Form Email</td>
<td><input name="txtFormEmail" type="text"></td>
</tr>
<tr>
<td> </td>
<td><input type="submit" name="Submit" value="Send"></td>
</tr>
</table>
<br>
<br>
<br>
</form>
</body>
</html>
Code (phpSendMailContactForm.php)
<html>
<head>
<title>ThaiCreate.Com PHP Sending Email</title>
</head>
<body>
<?
$strTo = $_POST["txtTo"];
$strSubject = $_POST["txtSubject"];
$strHeader = "Content-type: text/html; charset=windows-874\n"; // or UTF-8 //
$strHeader .= "From: ".$_POST["txtFormName"]."<".$_POST["txtFormEmail"].">\nReply-To: ".$_POST["txtFormEmail"]."";
$strMessage = nl2br($_POST["txtDescription"]);
$flgSend = @mail($strTo,$strSubject,$strMessage,$strHeader); // @ = No Show Error //
if($flgSend)
{
echo "Email Sending.";
}
else
{
echo "Email Can Not Send.";
}
?>
</body>
</html>
|
|
|
|
|
Date :
2009-04-25 10:14:34 |
By :
webmaster |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 02
|