Simple PHP Contact Form Not Sending [closed]

别来无恙 提交于 2019-12-14 03:47:10

问题


After posting a more robust example I couldn't figure out, and browsing around on a few entries with no avail, I can't get possibly the simplest PHP contact form in the world to work.

I broke it down from the last entry to see if I could at least send an email. I've tested all the $var elements and they're being recognized with a simple echo check, so I know that's not the issue. I also checked the SMTP compatibility and that's fine too.

The probelm is when I click "Submit" on the live form, the message will pop up saying "Thank You" but I'm not receiving any emails in my inbox.

What could I be missing here?

To start, here's the HTML

    <form action="contactus.php" method="POST" class="create">
     <fieldset>
    <legend align="center">Please fill out details below and click "Submit"</legend>
    <div>
     <label for="fullname" class="fixedwidth">Full Name</label>
     <input type="text" name="fullname" id="fullname" class="input2"/>
    </div><br/>
    <div>
     <label for="email" class="fixedwidth">Email</label>
     <input type="text" name="email" id="email" class="input2"/>
    </div><br/>
      <div>
     <label for="subject" class="fixedwidth">Subject</label>
     <input type="text" name="subject" id="subject" class="input2"/>
    </div><br/>
    <div>
    <label for="details" class="fixedwidth">Body</label>
     <textarea id="details" name="details" cols="62" rows="20"></textarea>
    </div>
    <div class="buttonarea">
        <input type="submit" name="submit" id="submit" value="Submit"/>
    </div>

    </fieldset>
   </form>

and here's the PHP

<?php 
$fullname = $_POST['fullname'];
$email = $_POST['email'];
$subject = $_POST['subject'];
$details = $_POST['details'];
$formcontent = "From: $fullname \n Message: $details";
$recipient = "johndoe1@email.com";
$mailheader = "From: $email \r\n";
mail($recipient, $subject, $formcontent, $mailheader) or die("Error!");
echo "Thank You!";
?>

来源:https://stackoverflow.com/questions/12232662/simple-php-contact-form-not-sending

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!