mail(): Failed to connect to mailserver at "localhost" port 25, - Hack The Tech - Latest News related to Computer and Technology

Hack The Tech - Latest News related to Computer and Technology

Get Daily Latest News related to Computer and Technology and hack the world.

Thursday, September 28, 2023

mail(): Failed to connect to mailserver at "localhost" port 25,

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 &quot;localhost&quot; port 25, verify your &quot;SMTP&quot; and &quot;smtp_port&quot; 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