What is the problem with this code that can't send emails for me ?
if (isset($_POST['name']) and (isset($_POST['email'])) and (isset($_POST['text']))) {
$name = $_POST['name'];
$email = $_POST['email'];
$text = $_POST['text'];
if (!empty($name) and !empty($email) and !empty($text)) {
$to = 'info@test34.com';
$subject = 'Testing';
$body = $text;
$headers = 'From : test@test.com';
if(mail($to, $subject,$body,$headers)) {
echo 'Email Has bin sent.';
}
else echo "Can't Send mail";
}
}
I Have tried many times but the code is not working.
And the HTML is :
<html>
<form action="" method="POST">
Name : <br>
<input type="text" name="name">
<br><br>
Email : <br>
<input type="email" name="email">
<br><br>
Message : <br>
<textarea name="text" rows="6" cols="30"></textarea>
<Br><br>
<input type="submit" value="Send">
</form>
</html>
What should i do now ? Please Help me :(