Connect time out, when I did send email from xampp (localhost)

hi all,

I just learning about send many email over localhost (xampp) and I use PHP for programming language, Okay now i’ve finished to configured all apache, php.ini and mercury server but when I am trying to send an email over this script :

<?php

    $subject="Test mail";
    $to="xxx@gmail.com";
    $body="This is a test mail";
    $from="xxx@gmail.com";
    
    if (mail($to,$subject,$body, 'from: xxx@gmail.com'))
        echo "Mail sent successfully!";
    else
        echo"Mail not sent!";
?>

I just got notice that my message was successful to sent. but when i check out my gmail I’m not see new email in here. Okay i now open the error.log in xampp then i notice about something wrong in here :

sendmail: Error during delivery: Connect timed out.

so, what should I do now ?

Do you have a mail server running on your box? Is it definitely working?

Equally, if this is a home / test server… can that server send out mail correctly? Some providers block / filter outbound SMTP requests.