I am trying to make a mail verification system via xampp. but I get such an error: <b>Warning</b>: mail(): Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in <b>
sendmail codes inside xamppin:
[sendmail]
smtp_server=smtp.gmail.com
smtp_port=587
error_logfile=error.log
debug_logfile=debug.log
auth_username=xxxxxxxxxx@gmail.com
auth_password=xxxxxxxxx
forcer_sender=xxxxxxxx@gmail.com
php codes:
if($otp){
$receiver = $email;
$subject = "From: $name <$name>";
$body = "Name "." $name \n Email "." $email \n "." $otp";
$sender = "From: xxxxxxxxx@gmail.com";
if(mail($receiver,$subject,$body,$sender)){
echo "success.";
}
else{
echo "error!" . mysqli_error($conn);
}
}```
note: I changed the php codes inside the xampp folder.
source https://stackoverflow.com/questions/77189558/mail-failed-to-connect-to-mailserver-at-quotlocalhostquot-port-25
No comments:
Post a Comment