If you are using XAMPP or WAMP server as web server then you need to do small change in php.ini file
In php.ini file at
before
SMTP = localhost
smtp_port = 25
After
SMTP =
smtp.gmail.comsmtp_port = 25
You can also use any SMTP server details with the correct port number.
Under linux OS you need to have at least sendmail installed.
Hope this helps you