im using this code and it prints out sent but im not reciving any email i have sat that on my local server configured the mail function and everything is correct but still not working
$to = "xxxx@yahoo.com";
$subject = "$name";
$txt = "$msg";
$headers = "From: xxxx@gmail.com";
if (mail($to,$subject,$txt, $headers)){
echo "sent";
}else{
echo "error";
}
it keeps sayin that Sent but im not getting any email
Server side spam filtering might be the issue in your case, especially if you are sending email to some of the organizational email addresses. If so this article may be useful to you..
This is difficult to debug only using the client code. You have to check the server logs if you have privileges to do so
You will need to alter your php.ini and sendmail cfg to allow sending from local server. Here's my config.
PHP.ini - Make sure sendmail_path is pointing to the correct exe. This is under [mail function] in php.ini
sendmail_path = "\"C:\xampp\sendmail\sendmail.exe\" -t"
;sendmail_path = "C:\xampp\mailtodisk\mailtodisk.exe"
Sendmail.ini [sendmail]
smtp_server=smtp.gmail.com
smtp_port=25
error_logfile=error.log
debug_logfile=debug.log
auth_username=gmail address
auth_password=gmail password
force_sender=gmail address
Obviously this is configured to work with gmail but any other smtp server with the correect config in sendmail will work.