-1

I am using Ampps on Mac and trying to send an email using php from a contact form however I do not receive the mail and when the form is submitted it redirects me to the file page resulting in a blank display

my form :

<form action="email.php" method="post">
                <div class="col-md-6 w3_agileits_contact_left">
                    <span class="input input--akira">
                        <input class="input__field input__field--akira" type="text" id="input-22" name="Name" placeholder="" required="" />
                        <label class="input__label input__label--akira" for="input-22">
                            <span class="input__label-content input__label-content--akira">Your name</span>
                        </label>
                    </span>
                    <span class="input input--akira">
                        <input class="input__field input__field--akira" type="email" id="input-23" name="Email" placeholder="" required="" />
                        <label class="input__label input__label--akira" for="input-23">
                            <span class="input__label-content input__label-content--akira">Your email</span>
                        </label>
                    </span>
                    <span class="input input--akira">
                        <input class="input__field input__field--akira" type="text" id="input-24" name="Subject" placeholder="" required="" />
                        <label class="input__label input__label--akira" for="input-24">
                            <span class="input__label-content input__label-content--akira">Your subject</span>
                        </label>
                    </span>
                </div>
                <div class="col-md-6 w3_agileits_contact_right">
                    <div class="w3_agileits_contact_right1">
                                                <textarea name="Message" id="Message" placeholder="Your comment here..." required=""></textarea>
                    </div>
                    <div class="w3_agileits_contact_right2">
                                                <input type="submit" value="Send">
                    </div>
                    <div class="clearfix"> </div>
                </div>
                <div class="clearfix"> </div>




            </form>

my File :

$email = $_POST['Email'];
                                    $name = $_POST['Name'];
                                    $to = "lucvanrooyen@gmail.com";
                                    $subject = $_POST['Subject'];
                                    $userMessage =$_POST['Message'];
                                    $headers = "From: $email\n";
                                    $message = "$name has sent you the following message.\n

                                    Message: $userMessage";
                                    $user = "$email";
                                    $usersubject = "Thank You";
                                    $userheaders = "From: lucvanrooyen@gmail.com\n";
                                    $usermessage = "Thank you for your enquiry we will be in touch.";
                                     mail($to,$subject,$message,$headers);
                                     mail($user,$usersubject,$usermessage,$userheaders);

2 Answers2

-1

The code you have shown is not enough to debug your problem.

If you are using the mail method which is built into the standard library, read this answer to find out a few troubleshooting steps you could follow.

If you are and are still finding it difficult to use, then you could consider using one of the PHP emailing solutions like -

sujaypatil
  • 60
  • 1
  • 10
-1

Please check your form tag. there is no opening tag for form

<form action="email.php" method="post">
Shibin Suresh
  • 363
  • 1
  • 2
  • 9