0

In this form submitting, I am facing some errors.

1. The mail is working. But Contact form submit details not showing.
2. Its working on only gmail. Like : abc@gmail.com
3. Not working on the domain like lucky@abc.com. The mail not working. 

Please give any suggestion.

<?php

       $Name = trim(strip_tags($_POST['Name']));
       $Email = trim(strip_tags($_POST['Email']));
       $Phone = trim(strip_tags($_POST['Phone']));
       $Subject = trim(strip_tags($_POST['Subject']));
       $Message = htmlentities($_POST['Message']);

       // set here
       $subject = "Contact form submitted!";
       $to = 'lachchanderdagar@gmail.com';

       $body = <<<HTML
$message
HTML;

       $headers = "From: $email\r\n";
       $headers .= "Content-type: text/html\r\n";

       // send the email
       mail($to, $subject, $body, $headers);

       // redirect afterwords, if needed
       header('Location: thanksforcontact.php');
?>
RiggsFolly
  • 93,638
  • 21
  • 103
  • 149
  • Did you intend to put what looks like a real email in your posted code? – Nick Jul 14 '18 at 17:15
  • Problem 1: you aren't using $Name, $Phone, $Subject or $Message so that's why they aren't included. `$message` is not the same variable as `$Message`. – Nick Jul 14 '18 at 17:19
  • Problem 3 is going to be server-side, not something SO can help with. – Nick Jul 14 '18 at 17:21
  • 4. trim & strip_tags wont prevent header injections. – Lawrence Cherone Jul 14 '18 at 17:23
  • Voted to close this with 1 question out of 3. The lack of error reporting and form details makes the first point unanswerable in its current form anyway. – mario Jul 14 '18 at 17:25

0 Answers0