用PHP实现用From发送电子邮件
说明:用PHP实现发送电子邮件是比较简单的,大家可以看看如下完整代码。
1,把下面这段代码复制到你的网页中,可以复制到.HTML文件中。
- <form action="mail.php" method="post">
- <p align="center">
- <font >
- Name:<br>
- <input type="text" name="name" ><br>
- E-Mail Address:<br>
- <input type="text" name="email" ><Br>
- Website URL:<br>
- <input type="text" name="url" ><Br>
- <input type="submit" value="Submit" >
2,建立mail.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."
- ?>