-3

please assist with my PHP form. Following this text I have both my HTML form as well as my PHP page described. I am not receiving the e-mails when I attempt to use the form on my website. I have validated that my e-mail address is working, and that should not be the issue.

The following is my HTML form:

                                    <!-- Contact Form -->
                <div class="col-md-6 col-sm-6">
                    <hr>
                    <p>Have a question or comment? Fill out the form below.</p>
                    <div class="contact-form  wow fadeInLeft showdelay2">
                    <form  name="sentMessage" id="contactForm" novalidate>
                        <div class="control-group form-group">
                            <div class="controls">
                                <label>Name</label>
                                <input type="text" class="form-control dark" id="name" placeholder="Name" required data-validation-required-message="Please enter your name.">
                                <p class="help-block"></p>
                            </div>
                        </div>
                        <div class="control-group form-group">
                            <div class="controls">
                                <label>Email</label>
                                <input type="email" class="form-control dark" id="email" placeholder="Email Address" required data-validation-required-message="Please enter your email address.">
                                <p class="help-block"></p>
                            </div>
                        </div>
                        <div class="control-group form-group">
                            <div class="controls">
                                <label>Message</label>
                                <textarea class="form-control dark" rows="7" id="message" placeholder="Message" required data-validation-required-message="Please enter your message" maxlength="999" style="resize:none"></textarea>
                                <p class="help-block"></p>
                            </div>
                        </div>
                        <div id="success"></div>
                        <div class="pull-right">
                        <button type="submit" class="btn btn-info btn-lg">Submit</button>
                        </div>
                    </form>
                    <div class="clearfix"></div>
                    </div>
                </div>
                <!-- ./contact form -->

The following code is my contact_me.php page, which doesn't appear to be working.

<?php
// check if fields passed are empty
if(empty($_POST['name'])        ||
   empty($_POST['email'])       ||
   empty($_POST['message']) ||
   !filter_var($_POST['email'],FILTER_VALIDATE_EMAIL))
   {
    echo "No arguments Provided!";
    return false;
   }

$name = $_POST['name'];
$email_address = $_POST['email'];
$message = $_POST['message'];

// create email body and send it    
$to = 'email@addresss.com'; 'email@address.com'; // PUT YOUR EMAIL ADDRESS HERE
$email_subject = "Contact form from:  $name"; // EDIT THE EMAIL SUBJECT LINE HERE
$email_body = "You have received a new message from your website's contact form.\n\n"."Here are the details:\n\nName: $name\n\nEmail: $email_address\n\nMessage:\n$message";
$headers = "From: info@bootstrapwizard.info\n";
$headers .= "Reply-To: $email_address"; 
mail($to,$email_subject,$email_body,$headers);
return true;            
?>

1 Answers1

1

your to string is incorrect, the valid format is:

$to = 'AdrianPham@crosshatcheatery.com,Webmaster@crosshatcheatery.com'; 

the headers should end with "\r\n"

$headers = "From: info@bootstrapwizard.info\r\n";
$headers .= "Reply-To: $email_address"; 
  • Thanks very much Dagon, for the reply. However, I have made the changes you suggested and yet I am still not receiving the e-mails. – UntoldDawn Oct 17 '15 at 23:58
  • i would start by checking the mail logs and the return vale of the mail call –  Oct 18 '15 at 00:08