I'm working on PHP send mail. Here I have using send mail and I have done all local setup Sendmail path but still not getting any mail. what might be the problem here. I don't want to use SMTP(). Below is my sample code. Can you suggest me 1) With SMTP 2) Without SMTP which one is the better choice?
<form action="form.php" method="POST">
Mail to: <input type="text" name="to"><br>
Subject: <input type="text" name="subject"><br>
Message: <input type="text" name="message"><br>
<input type="submit" value="SEND">
</form>
<?php
$to=$_POST["to"];
$subject=$_POST["subject"];
$message=$_POST["message"];
$mail = mail ($to, $subject, $message );
if($mail == false){
echo 'Mailer Error ';
}else{
echo 'Message has been sent without using SMTP.';
}
?>