1

I am sending mail to my id from contact form but not getting any mail in my id. yes i have uploaded in server but still not working, here is code

contact.html

<form  action="contact.php" method="post">
            <label class="label">Name <em>*</em></label>
            <label class="input">
                <input type="text" name="name" id="name">
            </label>

            <div class="clearfix"></div>

            <label class="label">E-mail <em>*</em></label>
            <label class="input">
                <input type="email" name="email" id="email">
            </label>

            <!-- <div class="clearfix"></div>


            <label class="label">Phone <em>*</em></label>
            <label class="input">
                <input type="text" name="phone" id="phone">
            </label> -->

            <div class="clearfix"></div>

            <label class="label">Subject <em>*</em></label>
            <label class="input">
                <input type="text" name="subject" id="subject">
            </label>

            <div class="clearfix"></div>

            <label class="label">Message <em>*</em></label>
            <label class="textarea">
                <textarea rows="5" name="content" id="message"></textarea>
            </label>

            <div class="clearfix"></div>

            <button type="submit"  name="submit" class="button">Send Message</button>

        </form>

Here is the code for contact.php

<?php 
if(isset($_POST['submit'])){
    $to = "snigdhasrk143@gmail.com"; // this is your Email address
    $from = $_POST['email']; // this is the sender's Email address
    $full_name = $_POST['name'];
    $subject = $_POST['subject'];
    $content = $_POST['content'];
    $subject2 = "Copy of your form submission";
    $message = $full_name . " " . $from . " -- wrote the following:" . "\n\n" . $_POST['content'];
    $message2 = "Here is a copy of your message " . $full_name . "\n\n" . $_POST['content'];

    $headers = "From:" . $from;
    $headers2 = "From:" . $to;
    mail($to,$subject,$message,$headers);
    mail($from,$subject2,$message2,$headers2); // sends a copy of the message to the sender
    header('Location: index.html');
        // You can also use header('Location: thank_you.php'); to redirect to another page.
    }
?>

its successfully redirected to index page but not getting any mail ? plz help

Iam Srkfan
  • 197
  • 9
  • I suggest you use another mailer (ie PHPMailer). One major difference from the built in mail() function is that most (all?) other mailers actually give you errors if something fails. With an error you aren't debugging in the blind as you are now. – JimL Aug 04 '17 at 21:04
  • confused , any tutorial link? @JimL sry :( – Iam Srkfan Aug 04 '17 at 21:23
  • https://github.com/PHPMailer/PHPMailer – JimL Aug 04 '17 at 21:24

0 Answers0