Send mail from your localhost

Hello Friends !!

When you developing your site then you are facing a problem that how to send mail from your local host ?

Because when you are testing your project/site in localhost then this problem occurred. At that time you think about upload your site on server.

If you don’t want this type of uploading work and you want to test your mail form your localhost then here is the solution.

First of all open your xamp or wamp installed directory.
Then open php directory and find php.ini.

Then open this php.ini in notepad and find [mail function] in that file.

When you find it, remove semi colon before SMTP,smtp_port and sendmail_from.

Set this parameters like this :  //it indicates mail server

smtp_port=25            // it indicates port address   // it indicates mail id from which you want to send mail

After this, please stop you xamp/wamp services, do refresh and start it again.

Thats it.. Now you can send mail from your localhost..

If you have any query or any confusion then feel free to comment me.

Thanks !!

  • Pingback: Send mail from your localhost | php genious |

  • Rajyeshbanerjee55

    I’ve done exactly that corrections in my php.ini file to send mail from localhost what u’ve suggested.but till i’m geting an error like’ Warning: mail() [function.mail]: Failed to connect to mailserver at “” port 25, verify your “SMTP” and “smtp_port” setting in php.ini or use ini_set() in C:xampphtdocsmail.php on line 7 Mail Sent.’ and mail actually not sent to my own gmail account..Pl tell me what would have to be done to make it dome.

  • Hire PHP Developer

    Thanks WordPress Developer for clear explanation on how to send mail from your localhost. I’ve developed small project management system running in local area connection. In this system I need to send email from my php mail function from localhost but when trying to to do same I got some error message. I’ve done above changes in my configuration files and achieve my needs. Thanks again.

  • PHP Developer

    Thanks for your codes, i follow these process and got success, thanks a lot..

  • Dedicated iPhone Developer

    I love the useful information you provide inside your content articles. I will bookmark your webpage and check all over again here generally. I’m quite sure I will learn plenty of new things right here! Good luck for the next!blog

  • Anonymous

     i done all these changes, but still not sending mail from localhost and give error………then what will i do…….?

  • robteed

    When I put the website live should I reinsert the semi colon’s

  • Hardik

    one problem is there ..i’ve configure ini file as u say and now my mail function is work and also message will display like successfully mail sent..but in my mail account i could not get mail..

  • Hardik

    and sure my smtp mail server is proper!!

  • Gajendra Nayal

    Thanks for this post

  • M.Phanindra Reddy

    Hi sir , I have done the same thing what you have told..
    But I am not getting any mail to my mail id..can u tell me where i might went wrong.

    Plz…waiting for ur response