@mail no envía correo en php
Esta es la primera vez que estoy usando la función de correo. Intenté enviar un correo usando esto y el código me dice que está "enviado con éxito", pero no recibí ningún correo. Estoy confundido leyendo muchos artículos sobre esto. Por favor, ayúdame.
<?php
if(isset($_POST['author'])&& isset($_POST['subject'])&& isset($_POST['text'])) {
//Email
$email_to = "[email protected]";
$email_subject = "Query From HYPERMARKETS";
$name = $_POST['author']; // required
$sub = $_POST['subject']; // required
$comments = $_POST['text']; // required
echo "POST:".$name.$sub.$comments;
$error_message = "";
$string_exp = "^[a-z .'-]+$";
if(!strcmp($string_exp,$name)) {
$error_message .= 'The Name you entered does not appear to be valid.<br />';
}
if(strlen($comments) < 5) {
$error_message .= 'The Comments you entered do not appear to be valid.<br />';
}
if(strlen($error_message) > 0) {
echo ("<center><table border=1 cellspacing=5 cellpadding=5><tr><th>$error_message</th></tr></table></center>");
}
$email_message = "Form details below.\n\n";
$email_message .= "Name: ".$name."\n";
$email_message .= "Subject: ".$sub."\n";
$email_message .= "Comments: ".$comments."\n";
// create email headers
$headers = "From: [email protected] \r\n Reply-To: [email protected] \r\n" ;
if(@mail($email_to, $email_subject, $email_message, $headers))
echo "<center><table border=1 cellspacing=5 cellpadding=5><tr><th>MESSAGE SENT SUCCESSFULLY</th></tr></table></center>";
else
echo "<center><table border=1 cellspacing=5 cellpadding=5><tr><th>MESSAGE NOT SENT</th></tr></table></center>";
}
else
echo ("<center><table border=1 cellspacing=5 cellpadding=5><tr><th>FILL ALL THE FIELDS..!!</th></tr></table></center>");
?>
Hola, he configurado mi archivo php.ini como
[mail function]
sendmail_from = postmaster@localhost
SMTP = localhost
smtp_port = 25
sendmail_path = "\"C:\xampp\sendmail\sendmail.exe\" -t"
sendmail_path = "C:\xampp\mailtodisk\mailtodisk.exe"
Todavía no funciona.