After struggling for hours, I was able to configure my localhost to send email. This was working untill I upgraded by xampp to 1.8 on win 7 Pro.
So to help someone, I am listing the steps that I followed
Step – 1: Open php.ini and make some changes to [mail function]. The php.ini is under XAMPP\php\php.ini
Step – 2: Make following changes ( assuming xampp is installed on D: drive )
SMTP = localhost
smtp_port = 25
sendmail_path = "\"D:\xampp\sendmail\sendmail.exe\" -t"
Step – 3: Save php.ini and make sure to restart xampp.
Step – 4: You can use the existing sendmail or also can download the latest sendmail from http://glob.com.au/sendmail/
Step – 5: Make changes to existing sendmail.ini ( D:\xampp\sendmail\sendmail.ini ) or unzip the contents of above zip to this folder and change in new sendmail.ini
smtp_server=smtp.gmail.com
smtp_port=465
smtp_ssl=auto
error_logfile=error.log
debug_logfile=debug.log
auth_username=YOUR_GMAIL_USERNAME@gmail.com
auth_password=YOUR_GMAIL_PASSWORD
force_sender=YOUR_GMAIL_USERNAME@gmail.com
Comment the following lines by adding semicolon
;pop3_server=
;pop3_username=
;pop3_password=
;hostname=
You are done, you can now send emails from localhost.