Send mail with php mail() function.
Please review my code. It is not sending mail and the landing page is not being called. I have tested with another script to send mail on my host and it is working fine.
<?php
> if (isset($_POST['submit'])) {
>
> $name=$_POST['name'];
> $mailFrom=$_POST['email'];
> $message=$_POST['message'];
> $mobile=$_POST['mobile'];
>
>
> $mailTo="xxxxx";
> $headers= "From : ".$mailFrom;
> $txt ="You have received an email from".$name. ".nn".$message. ".nn Mobile :".$mobile;
> $subject="Information Request";
> mail($mailTo, $subject, $txt, $headers);
>
> header("Location: xxx.html"); //to create a landing page and test
> }
> ?>
2
Answers
I have changed the code to below and it is working. The issue was perhaps with the if statement
Based on your code, I would start checking things out from your "if" statement. See if the statement is reachable or not.
I would suggest you go through PHP mail function doesn't complete sending of e-mail . It covers everything.