To send mail from localhost (WAMP, XAMP, or LAMP) you can use PHPMailer package (Download PHPMailer from here).
First you have to edit the "php.ini" To find this file display the phpinfo by using following code from the WAMP server. Create one php file and add this content.
<?php
echo phpinfo();
?>
There search for "Loaded Configuration File" That will be the path to your php.ini.
In this file remove the ;(semi colon) given to extension=php_openssl.dll.
After downloading PHPMailerX.X.X package
Extract->Copy the full folder into your project folder.
In test folder there is one file called testemail.php.
Change the parameter as your need. (Example given below).
Then in the browser type 127.0.0.1/PHPMailer/test/testemail.php.
Then it will show successful message if email sent, else it will give error message.
Example:
//add these codes if not written
$mail->IsSMTP();
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->SMTPSecure = "ssl"; // sets the prefix to the servier
$mail->Host = "smtp.gmail.com"; // sets GMAIL as the SMTP server
$mail->Port = 465;
//You have to change these parameters to your requirements.
//…….code….
$mail->Username = “abc@gmail.com”; // GMAIL username
$mail->Password = “abcdefgh”; // GMAIL password
//……..code….. There are many other functions to attach file etc.. For that refer doc file.
$mail->AddAddress(“destination@gmail.com”,”Nick name”);
//…….code…..