Have you ever been frustrating, why e-mail is not going from the localhost while using XAMPP or WAMP or any other PHP servers in windows environment? well in that situation i think i can help you.In this article i am going to tell you how to send e-mail from localhost in PHP.
1) Open the “php.ini“. You should know where it is located because it depends upon the particular server you’re running.
2) Search for the attribute called “SMTP” in the php.ini file.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.I’ve set the following values in my php.ini file.
SMTP = smtp.wlink.com.np
smtp_port = 25
3) Restart the apache server so that PHP modules and attributes will be reloaded.
4) Now try to send the mail using the mail() function ,
Well that’s all, the mail is sent to “firstname.lastname@example.org” from the localhost.
Note : Some smtp server verifies the email address of the sender so the email address which is in the place of “email@example.com” should be a valid and existing email address otherwise mail might not be sent to the “firstname.lastname@example.org”.