You can send email from localhost with minimum configuration.
Please check below steps to send an email from localhost.
In the sendmail.ini file (C:\xampp\sendmail\sendmail.ini), make the following changes:
smtp_port=587 (some recommend using smtp_port=25 but for me 587 worked)
Next, make the following change in your php.ini (C:\xampp\php\php.ini) file:
sendmail_path = “\”C:\xampp\sendmail\sendmail.exe\” -t”
t's very easy to configure php.ini for sending e-mails from your server.You just need to configure php.ini and sendmail.ini correctly.
First you have to configure sendmail_path in your php.ini file it should have to point to executable sendmail file with proper flags
for example , ;sendmail_path = "\"C:\xampp\sendmail\sendmail.exe\" -t" (which is already in your php.ini file need to just remove comment) and other assignments to sendmail_path need to be commented.
after configuring php.ini file you need to configure sendmail.ini file ,in that
first smtp_server=mail.gmail.com (as you want to use gmail as smtp server), second smtp_port=465 (if not worked try 587), third auth_username= firstname.lastname@example.org auth_password=yourpassword
after this restart your server.
I hope this will help you.