php mail function not working

丶灬走出姿态 提交于 2019-12-10 10:52:08

问题


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


回答1:


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 );



回答2:


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.




回答3:


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.



来源:https://stackoverflow.com/questions/3633144/php-mail-function-not-working

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!