2
votes

when i tried sending a mail using php mail function at localhost, i get the following error....what could be the issue....i even tried changing php.ini file and gave smtp host value my service provider value and it still dint work

Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in

3
mailserver at "localhost" port 25 - Is there an smtp server supposed to be running on your machine? - VolkerK
no. i dont have any smtp server - Sanjai Palliyil

3 Answers

2
votes

For me, adding the following code in the calling file did the trick

// xampp code fix      
ini_set( 'sendmail_from', "[email protected]" ); \\ My usual e-mail address
ini_set( 'SMTP', "mail.bigpond.com" );  \\ My usual sender
ini_set( 'smtp_port', 25 );
1
votes

I have used Fake Sendmail to successfully send emails from my localhost running WAMP.

Try following the instructions here to get it up and running.

0
votes

Well do you have a mailserver configured on localhost? Otherwise to use mail you will probably have to use you internets provider smtp servers instead of localhost to connect.