说明:用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."
?>
文章来源于领测软件测试网 https://www.ltesting.net/