I was so worried that i was not able to send the E-mail from the localhost while using WAMP and i asked to my teacher that how can i send the E-mail from the localhost ? and he instructed me to follow the given instruction. This instruction is for both WAMP and XAMPP users.
1. Now open php.ini file.
2. search for the STMP attribute. Generally you can find the line “SMTP=localhost“. change the localhost to the smtp server name of your ISP. And, there is another attribute called “smtp_port” which should be set to 25.
3. change the attribute as :
STMP = stmp.wlink.com.np
stmp_port = 25
I made stmp.wlink.com.np as my internet service provider (ISP) is Wlink.com.np
4.Now restart your apache server. so that your php.ini file will be reloaded.
5. now try sending the mail using main() function :)
thats it !!
You might get teh error message like this :
Warning: mail() [function.mail]: “sendmail_from” not set in php.ini or custom “From:” header missing in D:\wamp\www\Website\mail.php on line 28
if you get the error like this the specify the following headers and try again.
$headers = ‘MIME-Version: 1.0′ . “\r\n”;
$headers .= ‘Content-type: text/html; charset=iso-8859-1′ . “\r\n”;
$headers .= ‘From: sender@sender.com’ . “\r\n”;
mail(“you@yourdomain.com”,”subject”,”body”,$headers);
Now it will work :)