如何使用php处理邮件处理

时间:2017-01-08 06:28:16

标签: php html forms

我在使用php在html中设置电子邮件发送表单时遇到了一些问题。我得到的错误是这样的:

无法发布/public/mail_handler.php

我不确定问题出在哪里。这是html:

    <form id="appt" action="/public/mail_handler.php" method="POST">

        <input type="text" name="firstname" placeholder="First Name..."> <br>
        <br>
        <input type="text" name="lastname" placeholder="Last Name..."> <br>
        <br>
        <input type="text" name="email" placeholder="Email..."> <br>
        <br>
        <input type="text" name="phone" placeholder="Callback Number..."> <br>
        <br>
        <input type="radio" name="type" value="New"> Schedule an appointment regarding making a computer <br>
        <input type="radio" name="type" value="Old"> Call about a computer we made <br>
        <input type="radio" name="type" value="Current"> Ask about the status of your build <br>
        <input type="radio" name="type" value="Other"> Have a question about something else <br>
        <input type="submit" name="submit" value="Submit">

    </form>

和php:

<?php 

if(isset($_POST['submit'])){

$to = $_POST['email'];
$from = "ajippov@gmail.com"; 
$firstname = $_POST['firstname'];
$lastname = $_POST['lastname'];
$phone = $_POST['phone'];
$subject = "Testing"; 
$body = "This is a test"; 

mail($to, $subject, $body); 

echo "Request has been sent"; 


}
?>

0 个答案:

没有答案