I already have made changes in both php.ini and sendmail.ini but still it doesn't work
php.ini
[mail function]
SMTP=smtp.gmail.com
smtp_port=25
sendmail_from = kaush3207@gmail.com
sendmail_path = "\"C:\xampp\sendmail\sendmail.exe\" -t"
sendmail.ini
[sendmail]
smtp_server=smtp.gmail.com
smtp_port=25
error_logfile=error.log
debug_logfile=debug.log
auth_username=kaush3207@gmail.com
auth_password= 12345
force_sender=kaush3207@gmail.com
OTP.php
$from ="kaush3207@gmail.com";
$to="soku2131@gmail.com";
$subject="verify-account-otp";
// Generating otp with php rand variable
$otp=rand(100000,999999);
$message=strval($otp);
$headers="From: ".$from;
$send=mail($to,$subject,$message,$headers);
if($send){
echo "OTP sent";
}
else
{
echo "OTP not sent";
}
It always gives "OTP not sent". I have also tried with port no. 587 and 465 but it doesn't work.