Đây là một ví dụ về dùng hàm mail() trong PHP, đoạn code đơn giản, về sau Bạn có thể phát triển thêm như hàm hiểm tra địa chỉ email, chống flood...
PHP Code:
<?
if ($name!="" and $comment!="")
{
echo "Thanks for your mail!";
$content = "Name: ".$name."\nComment:".$comment;
mail("your_email@***","Mail from ".$name,$content);
}
else
{
?>
<!----HTML-Formular---->
Please enter a comment and press the SUBMIT BUTTON
<form action="<? echo $PHP_SELF; ?>" method="post">
your name:<br><input type=text name=name><br>
your comment:<br><textarea name=comment></textarea><br>
<input type=submit name=submit value=submit>
</form>
<?
}
?>
Bookmarks