Here i am showing you the way,how to send email from XAMPP or WAMP (localhost) in PHP in Windows.

1) Open the “php.ini”. For XAMPP,it is located in C:\XAMPP\php\php.ini. Find out if you are using WAMPP server.

2) Search [mail function] in the php.ini file.

You can find like below.
[mail function]
; For Win32 only.
SMTP = localhost
smtp_port = 25
; For Win32 only.
sendmail_from = me@localhost.com

Change the localhost to the smtp server name of your ISP. No need to change the smtp_port. Leave it as 25.
Change sendmail_from from me@localhost.com to your domain email address which will be used as from address..

So for me, it will become like this.
[mail function]
; For Win32 only.
SMTP = smtp.programmingfacts.com
smtp_port = 25
; For Win32 only.
sendmail_from = info@programmingfacts.com

3) Restart the XAMPP or WAMP(apache server) so that changes will start working.

4) Now try to send the mail using the mail() function ,

mail(“raxit4u2@gmail.com”,”Success”,”Thanks, that works”);

Well that’s all, now mail is sent to “raxit4u2@gmail.com” from the localhost.

http://www.programmingfacts.com/send-email-localhostxampp-wamp/