You can`t directly from localhost. One way is to move your code to public server or using some SMTP server if you want to work on your localhost.
You should make some changes to those two files xampp\php\php.ini and xampp\sendmail\sendmail.ini
in php.ini file search and find [mail function] and make it look like this
SMTP=smtp.gmail.com
smtp_port=465
sendmail_from = YOUR_MAIL@gmail.com
sendmail_path = "\"C:\xampp\sendmail\sendmail.exe\" -t"
now in sendmail.ini make sure it look like this
[sendmail]
smtp_server=smtp.gmail.com
smtp_port=465
error_logfile=error.log
debug_logfile=debug.log
auth_username=YOUR_MAIL@gmail.com
auth_password=YOUR_MAIL_PASS
force_sender=YOUR_MAIL@gmail.com
Now make sure in php.ini
extension=php_openssl.dll
is uncommented. Also make sure to comment following line if there is another sendmail_path
sendmail_path="C:\xampp\mailtodisk\mailtodisk.exe"
If everything is OK your will be sending mail from localhost using google gmail. So the receiver will see your gmail in FROM field