<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>
<html> <head> <title>ThaiCreate.Com PHP Sending Email</title> </head> <body> <?php $strTo = $_POST["txtTo"]; $strSubject = $_POST["txtSubject"]; $strHeader = "Content-type: text/html; charset=windows-874\r\n"; // or UTF-8 // $strHeader .= "From: ".$_POST["txtFormName"]."<".$_POST["txtFormEmail"].">\r\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>
ช่วยกันสนับสนุนรักษาเว็บไซต์ความรู้แห่งนี้ไว้ด้วยการสนับสนุน Source Code 2.0 ของทีมงานไทยครีเอท