0

I am trying to create a contact form on my website and I created an email form but it doesn't email. I have tried changing the recipient multiple times but that does not seam to work. I am running it threw my server and it does the return message fine but it when I check my email to see if I have received it, I haven't. Any help would be greatly apreciated.

This is the HTML:

<form class="contact-form" action="mail.php" method="POST">
            <div class="smallContainer">
                <div class="contactLeft">
                    <h6>Name</h6>
                </div>
                    <input class="contact-input" name="name" type="text"></input>
            </div>
            <div class="smallContainer">
                <div class="contactLeft">
                    <h6>E-mail</h6>
                </div>
                    <input class="contact-input" name="email" type="text"></input>
            </div>
            <div class="smallContainer">
                <div class="contactLeft">
                    <h6>Phone Number</h6>
                </div>
                    <input class="contact-input" name="phone" type="text"></input>
            </div>
            <div class="smallContainer">
                <div class="contactLeft">
                    <h6>Subject</h6>
                </div>
                    <input class="contact-input" name="subject" type="text"></input>
            </div>
            <div class="smallContainer">
                <div class="contactLeft">
                    <h6>Your Message</h6>
                </div>
                    <textarea class="contact-textarea" name="message" rows="6"></textarea>
            </div>
<input class="submit btn btn-default" type="submit" value="Send"></input>
        </form>

This is all the PHP for the form:

<?php $name = $_POST['name'];
$email = $_POST['email'];
$message = $_POST['message'];
$formcontent="From: $name \n Message: $message";
$recipient = "megatravel15@gmail.com";
$subject = "Contact Form";
$mailheader = "From: $email \r\n";
mail($recipient, $subject, $formcontent, $mailheader) or die("Error!");
echo "Thank You!";
?>
Noah
  • 3
  • 3

1 Answers1

0

Check your email configuration in php.ini How is it configured? If it's configured like this:

[mail function]
; Setup for Linux systems
sendmail_path = /usr/sbin/sendmail -t
sendmail_from = me@myserver.com

Check that you have sendmail installed and working in that path.

namelivia
  • 2,657
  • 1
  • 21
  • 24