Sending mails is not an easy thing. You must have quite a knowledge how mailservers are working.
The PHP mail()-function supplys only a very simple API in order to send mail via SMTP servers that do *not* require any authorization. Unfortunately, all public SMTP servers (like smtp.gmail.com etc.) require authorization, therefore you *cannot* send mails directly via mail() using these public servers.
If you supply "localhost" as SMTP server, you must (of course) install a local SMTP server, for example Mercury. For the same reason, you must not configure it using any authorization. Mercury comes in several flavours, one of them is a real SMTP server, but usually most mail boxes block mails coming from privat IPs (like yours), these IPs are blacklisted due to SPAM reasons. Therefore it is not usefull to run Mercury as a real SMTP server. Instead, you may install Mercury as a "Relay SMTP" client, which simply relays all mails to a public SMTP server (like smtp.gmail.com). The big difference between using Mercury (and relaying mails to a public SMTP server) and directly sending mails to the public server is, that you have the opportunity to provide username and password for the public SMTP server when you use the Mercury Relay SMTP client. The authorization is not done by PHP (as it cannot authorize), but by Mercury. PHP only send the all mails to the local Mercury, and Mercury does "the real job". You need a mail account at Google (for example) in order to configure Mercury sending all mails to the Google SMTP Server.
There is another way of doing quite the same, it is called the "fake sendmail.exe" program. Instead of using Mercury, you may configure php.ini to use the sendmail.exe program (instead of using SMTP) which comes with Xampp, and (same as for using Mercury Relay SMTP), you have to configure sendmail.exe (as far as I know there is a sendmail.ini somewhere) to send all mails to a public SMTP server (i.e. smtp.gmail.com) using the userid and password for authorization which can be configured in sendmail.ini.
Last not least, you may avoid using the PHP mail() function, there is powerfull PHPmailer class, which provides lots of powerfull features, like
a) send email via authorized SMTP
b) send HTML emails
c) send Attachments (like pictures and music files)
d) ... and many more
and this class can be downloaded from
http://sourceforge.net/projects/phpmailer/files/If you use this class to send mail, you dont need to configure any third party software, as this class uses standard PHP socket functions instead.