Home > Net >  Send mail with Php mail () function and landing page
Send mail with Php mail () function and landing page

Time:11-15

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="[email protected]";
>     $headers= "From : ".$mailFrom;
>     $txt ="You have received an email from".$name. ".\n\n".$message. ".\n\n Mobile :".$mobile;
>     $subject="Information Request";
> mail($mailTo, $subject, $txt, $headers);
> 
> header("Location: thankyou.html"); //to create a landing page and test
> }
> ?>

CodePudding user response:

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.

CodePudding user response:

You are missing a closing bracket } in your if-statement.

  • Related