用PHP實現用From寄送電子郵件
來源:互聯網
上載者:User
本教程屬於原載,轉載請註明出自網頁教學網
說明:用PHP實現寄送電子郵件是比較簡單的!大家可以看看如下完整代碼。
1.把下面這段代碼複製到你的網頁中,可以複製到.HTML檔案中。
<form action="mail.php" method="post">
<p align="center">
<font face="Verdana">
Name:<br>
<input type="text" name="name" style="border: 1px solid #000000" style="font: Verdana" style="color: #000000" style="font-size: 8pt" style="background-color: #FFFFFF"><br>
E-Mail Address:<br>
<input type="text" name="email" style="border: 1px solid #000000" style="font: Verdana" style="color: #000000" style="font-size: 8pt" style="background-color: #FFFFFF"><Br>
Website URL:<br>
<input type="text" name="url" style="border: 1px solid #000000" style="font: Verdana" style="color: #000000" style="font-size: 8pt" style="background-color: #FFFFFF"><Br>
<input type="submit" value="Submit" style="border: 1px solid #000000" style="font: Verdana" style="color: #000000" style="font-size: 8pt" style="background-color: #FFFFFF">
2. 建立mail.php檔案,並且和上面的儲存在同一個目錄中。
<?
$contactemail = "you@yourdomain.com";
$subject = "You choose";
$message .= "Name: $name\n";
$message .= "E-mail: $email\n";
$message .= "Website URL: $url\n";
mail($contactemail, $subject, $message);
echo "Thanks for mailing me, I should reply with in a few
days."
?>