Quantcast
Channel: Active questions tagged email - Stack Overflow
Viewing all articles
Browse latest Browse all 29916

No mail were delivered when used mail.php [duplicate]

$
0
0

This question already has an answer here:

I have Index.html where i have created the form with some basic fields

<form class="modal-content animate" action="mail.php" method="post">


        <div class="container-form">
          <label for="full_Name"><b>Full Name</b></label>
          <input type="text" placeholder="Full Name" id="full_Name" name="full_Name" required>

          <label for="telephone_Number"><b>Mobile Number</b></label>
          <input type="text" placeholder="Mobile Number" name="telephone_Number" required>

          <label for="message"><b>Email Id</b></label>
          <input type="text" placeholder="Email Id" name="email_Address" required>
          <button type="submit" name = "submit" id="submit" class="read-more">Submit</button>
        </div>
      </form>

and i have include mail.php

<?php 
if(isset($_POST['submit'])){
    $to = $_POST['email_Address']; // this is your Email address
    $from = $_POST['xyz@gmail.com']; // this is the sender's Email address
    $full_Name = $_POST['full_Name'];
    $telephone_Number = $_POST['telephone_Number'];
    $subject = "Form submission";
    $message = " Dear". "$full_Name . ". "Thanks for contacting " . $telephone_Number . " wrote the following:" . "\n\n" . $_POST['message'];

    $headers[] = 'MIME-Version: 1.0';
    $headers[] = 'Content-type: text/html; charset=iso-8859-1';

    // Additional headers . Your to email id.
    $headers[] = 'From:  <'.$from.'>'; 

    // If you want to add To, Cc and Bcc use this additional headers
    $headers[] = 'To: <'.$to.'>'; 

// Mail it
mail($to, $subject, $message, implode("\r\n", $headers));
    echo "Mail Sent. Thank you " . $first_name . ", we will contact you shortly.";
    // You can also use header('Location: thank_you.php'); to redirect to another page.
    // You cannot use header and echo together. It's one or the other.
    }
?>

but when i click on submit button It shows "Mail Sent. Thank you, we will contact you shortly." but was not received any mail.


Viewing all articles
Browse latest Browse all 29916

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>