说明:用PHP实现发送电子邮件是比较简单的,大家可以看看如下完整代码。
1,把下面这段代码复制到你的网页中,可以复制到.HTML文件中。
1 2 3 4 5 6 7 8 9 10 | <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" >
|
Salin selepas log masuk
2,建立mail.php文件,并且和上面的保存在同一个目录中。
1 2 3 4 5 6 7 8 9 10 | <?php
$contactemail = "you@yourdomain.com" ;
$subject = "You choose" ;
$message .= "Name: $namen" ;
$message .= "E-mail: $emailn" ;
$message .= "Website URL: $urln" ;
mail( $contactemail , $subject , $message );
echo "Thanks for mailing me, I should reply with in a few
days."
?>
|
Salin selepas log masuk
永久地址:
转载随意~请带上教程地址吧^^