本地主机上的 php mail() 函数 [英] php mail() function on localhost

查看:33
本文介绍了本地主机上的 php mail() 函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在本地服务器上的 php mail() 函数有问题.当我尝试使用 php 函数发送电子邮件时,我无法在本地主机上测试我的电子邮件应用程序mail().

I have problem with php mail() function on localhost server. I can't test my email application on localhost when i'm trying to send emails with php function mail().

我收到此错误警告:mail() [function.mail]: 无法在localhost"端口 25 连接到邮件服务器,请验证 php.ini 中的SMTP"和smtp_port"设置或在 F:wamp 中使用 ini_set()wwwproductajax.php 第 64 行

我正在使用 WAMP 服务器,如果有人知道解决方案,请帮助我.

I'm using WAMP server and if anyone knows solution please help me.

推荐答案

你需要在你的机器上设置一个邮件服务器,邮件功能才能工作.如果你使用的是 Windows(我猜你是因为使用 WAMP),你可以设置一个 Pegasus 邮件服务器.

You need to setup a mail server on your machine for the mail function to work. If you are on Windows (which I am guessing you are from your use of WAMP) you can setup a Pegasus mail server.

其他选项包括使用包装类,例如 SwiftMailerPHPMailer 并使用它们连接到另一个 SMTP 服务器,例如您的 GMail 帐户.即使您在自己的本地主机路由上使用 Pegasus 邮件服务器,我仍然建议使用我上面提到的两个类之一.它们为您提供了更大的灵活性并且更安全.

Other options include using a wrapper class such as SwiftMailer or PHPMailer and using them to connect to another SMTP server such as your GMail account. Even if you go the Pegasus mail server on your own localhost route then I would still recommend using one of the two classes I have mentioned above. They give you far more flexibility and are safer.

连接到您的 ISP SMTP 服务器或 GMail 或任何最简单的路由.

Connecting to either your ISPs SMTP server or GMail or whatever is the easiest route out of this one.

这篇关于本地主机上的 php mail() 函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆