php php邮件功能不工作
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3633144/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
php mail function not working
提问by Sanjai Palliyil
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
当我尝试在本地主机上使用 php 邮件功能发送邮件时,我收到以下错误....可能是什么问题....我什至尝试更改 php.ini 文件并给 smtp 主机值我的服务提供商值和它仍然工作
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
警告:mail() [function.mail]:无法在“localhost”端口 25 连接到邮件服务器,请验证 php.ini 中的“SMTP”和“smtp_port”设置或使用 ini_set()
回答by Rhys
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 );
回答by tchow002
I have used Fake Sendmailto successfully send emails from my localhost running WAMP.
我使用Fake Sendmail从运行 WAMP 的本地主机成功发送电子邮件。
Try following the instructions hereto get it up and running.
尝试按照此处的说明启动并运行。
回答by Iznogood
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.
那么你在本地主机上配置了邮件服务器吗?否则,要使用邮件,您可能必须使用 Internet 提供商 smtp 服务器而不是 localhost 来连接。