php mail function not working
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
For me, adding the following code in the calling file did the trick
// xampp code fix
ini_set( 'sendmail_from', "myself@my.com" ); \\ My usual e-mail address
ini_set( 'SMTP', "mail.bigpond.com" ); \\ My usual sender
ini_set( 'smtp_port', 25 );
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.
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.
精彩评论