This is what i have done in php.ini:
[mail function]
sendmail_path = "\"C:\xampp\sendmail\sendmail.exe\" -t"
in sendmail.ini:
[sendmail]
smtp_server=smtp.gmail.com
smtp_port=587
error_logfile=error.log
debug_logfile=debug.log
auth_username=myemailid@gmail.com
auth_password=mypassword
force_sender=myemailid@gmail.com
And here is the code I wanted to run:
<?php
$to = 'anotheremail@gmail.com';
$subject = 'Hello from XAMPP!';
$message = 'This is a test';
$headers = "From: myemailid@gmail.com\r\n";
if (mail($to, $subject, $message, $headers)) {
echo "SUCCESS";
} else {
echo "ERROR";
}
?>
This is showing me SUCCESS as output. But, I am not receiving any email...