-1

I had my contact form up and running and I was doing a bit of housekeeping with how it actually looked when it arrived in my inbox. I dunno what I changed but even after reverting it back to when I know it was working it no longer sends emails but it 100% was working at some point!

Maybe its an issue with the host or the server but I've no clue.

Here is the contact form php.

<?php

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

  $emailFrom = 'myemail@gmail.com';
  $emailSubject = 'New Form Submission';
  $emailBody = "Name: $name. \n".
                "Email: $email. \n".
                "Phone: $phone 'n".
                "Message: $message.";

  $to = 'myemail@gmail.com';

  $headers = "From: $emailFrom \r\n";
  $headers .= "Reply to $email \r\n";
  
  mail($to,$emailSubject,$emailBody,$headers);

  header("Location: index.php")
?>

And here is the forms html

      <div id="contact" class="container contact-form">

        <div id="contactAnchor"></div><!--CONTACT ANCHOR TAG-->

        <div class="contact-image">
            <img id="contactLogo" src="/img/sam avatar no bg.png" width="150px" alt="SDB logo"/>
        </div>

        <form method="post" action="contactform.php">
            <h3>Drop Me a Message</h3>
          <div class="row">
            
            <div class="col">
              <div class="form-group">
                <input type="text" name="name" class="form-control" placeholder="Your Name *"/>
              </div>
              <div class="form-group">
                <input type="text" name="email" class="form-control" placeholder="Your Email *"/>
              </div>
              <div class="form-group">
                <input type="text" name="phone" class="form-control" placeholder="Your Phone Number"/>
              </div>
            </div>

            <div class="col">
              <div class="form-group">
                <textarea name="message" class="form-control" placeholder="Your Message *" style="width: 100%; height: 150px;"></textarea>
              </div>
              <div class="form-group">
                <input type="submit" name="btnSubmit" class="btn btn-success" value="Send Message" />
              </div>
            </div>

          </div>
        </form>
      </div>
Funk Forty Niner
  • 74,450
  • 15
  • 68
  • 141

1 Answers1

1

Not sure if this solves it, but your reply to header is incorrect:

$headers .= "Reply-To: $email \r\n";
mike
  • 41
  • 4