A lot of developers set up PHP on their local machine to test server side development. Here's a little trick how to be able to send email from localhost so you can test email without any difficulty.
Note: This only works when sending email to google hosted email addresses.
1. Go to your php.ini file and change
SMTP = localhost to
SMTP = aspmx.l.google.com and uncomment sendmail_from and put in your sending gmail address.
2. Go to cmd and type iisreset
3. In php, test it with mail("[youremail]@gmail.com", "subject", "body");