0

my HTML / PHP website does not send email from form. It is saying thank you but mail is not recieved. Why? please help!


<?php $name = $_POST['name'];
    $email = $_POST['mail'];
    $number = $_POST['number'];
    $message = $_POST['message'];
    $formcontent="From: $name \n Contact No: $number \n Message: $message";
    $recipient = "umair.bpd@gmail.com";
    $subject = "Contact form from website";
    $mailheader = "From: $email \r\n";
    mail($recipient, $subject, $formcontent, $mailheader) or die("Error!");
    echo "Thank You!";
?>

<form id="contact-form" action="submitform.php" method="POST">
    <input name="name" type="text" placeholder="Name">
    <input name="mail" type="text" placeholder="Email">
    <input name="number"  type="text" placeholder="Contact No.">
    <textarea name="message"  placeholder="Message"></textarea>
    <input type="submit" value="Send">
</form>
RiggsFolly
  • 93,638
  • 21
  • 103
  • 149
  • Thats in your question is it not – RiggsFolly Jan 05 '21 at 15:14
  • 2
    Does this answer your question? [PHP mail function doesn't complete sending of e-mail](https://stackoverflow.com/questions/24644436/php-mail-function-doesnt-complete-sending-of-e-mail) – El_Vanja Jan 05 '21 at 15:14
  • What error do you get? On what server are you running it? Do you use an email service? – Eden Moshe Jan 05 '21 at 15:14
  • It shows Thank You as the final message. but mail isn't recieved – Umair Aziz Jan 05 '21 at 15:16
  • Have you configured a mail server on your server? – Abbas Akhundov Jan 05 '21 at 15:27
  • Use mailtrap (https://mailtrap.io/) to trap your emails to see if you get them. If you're getting them in mailtrap but not through your mail server then your mail server isn't set up correctly. – Fly_Moe Jan 05 '21 at 15:47
  • If your server is correctly configured, it's possible that your webhost is blocking mails, or GMail temporarily refuses to receive from your host (happens easily if sites on from your IP send bulk mail, incl. convey form spam or other forwarded spam). See your mail logs for relevant information. – Markus AO Jan 05 '21 at 16:31

0 Answers0