I have wrote a simple php mail function which is on server which is showing error that mail not send , I have also checked if mail function worked or not and it showed that mail function is working but my this script is not working which is below
<?php
/*
* Enable error reporting
*/
ini_set( 'display_errors', 1 );
error_reporting( E_ALL );
/*
* Setup email addresses and change it to your own
*/
if(isset($_POST['send'])){
var_dump($_POST);
$from = "no-reply@skynetinfosolution.com";
$to = $_POST['to'];
$subject = $_POST['subject'];
$message = $_POST['body'];
$headers = "From:" . $from;
/*
* Test php mail function to see if it returns "true" or "false"
* Remember that if mail returns true does not guarantee
* that you will also receive the email
*/
if(mail($to,$subject,$message, $headers))
{
echo "Test email send.";
$headers .="MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
}
else
{
echo "Failed to send.";
//ror_get_last();
}
}
?>
<form action="mail2.php" method="post">
To<input type="email" name="to" placeholder="Enter email"><br/>
Subject<input type="type" name="subject" placeholder="Subeject"><br/>
Body<input type="text" name="body" placeholder="Body Message">
<input type="submit" name="send" value="Send">
</form>
</body>
</html>