简体   繁体   English

无法通过php邮件发送邮件()

[英]Unable to send mail via php mail()

I am unable to send an email via php's mail function. 我无法通过php的邮件功能发送电子邮件。

This is the error I receive. 这是我收到的错误。 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 D:\\inetpub\\vhosts\\southernbatteries.com\\httpdocs\\includes\\utils.php on line 6 Array ( [0] => [1] => Could not send mail, please try later... ) 警告:mail()[function.mail]:无法连接到“localhost”端口25的邮件服务器,验证php.ini中的“SMTP”和“smtp_port”设置,或者在D:\\ inetpub \\ vhosts \\中使用ini_set()第6行上的southernbatteries.com \\ httpdocs \\ includes \\ utils.php数组([0] => [1] =>无法发送邮件,请稍后再试......)

What exactly does this mean ? 这到底是什么意思 ? Does it mean there is not mail server installed on my webserver ? 这是否意味着我的网络服务器上没有安装邮件服务器? Is it possible to use a different mail server. 是否可以使用其他邮件服务器。 Eg Gmails mail server to send the mail ? 例如Gmails邮件服务器发送邮件?

If you want to use built-in mail() , you will need to talk to the server administrator. 如果要使用内置mail() ,则需要与服务器管理员联系。 It is possible to use an external SMTP server on Windows, but it has to be specified in the php.ini settings, and PHP's built-in functions don't support SMTP authentication. 可以在Windows上使用外部SMTP服务器,但必须在php.ini设置中指定,并且PHP的内置函数不支持SMTP身份验证。

The usual way is to either use a local mail server that in turn can talk to a "real" SMTP server with authentication, or use a mailing package like SwiftMailer that can connect to a 3rd party SMTP server like GMail directly. 通常的方法是使用本地邮件服务器,该服务器又可以与具有身份验证的“真实”SMTP服务器通信,或者使用可以直接连接到第三方SMTP服务器(如GMail)的SwiftMailer等邮件包。

You need to have a mail server to send mails. 您需要有一个邮件服务器来发送邮件。 If you only have apache, you cannot, unless you edit the php.ini file and set the smpt_server to one that allows you to do so. 如果您只有apache,则不能,除非您编辑php.ini文件并将smpt_server设置为允许您这样做的文件。 Note that this will only work depending on your ISP. 请注意,这仅适用于您的ISP。

If you have a hosting account you can upload the files and online they will work. 如果你有一个托管帐户,你可以上传文件和在线他们将工作。

You should run your own mailserver on your server. 您应该在服务器上运行自己的邮件服务器。 Most likely it's not started or not installed. 很可能它没有启动或没有安装。

As I can see your are running it on windows it's most likely the later. 我可以看到你在Windows上运行它很可能是后者。 You could try using your providers mail server. 您可以尝试使用提供商邮件服务器。 Or googles. 或谷歌。 But you need most likely a username and password for that. 但您最需要的是用户名和密码。

you should avoid using php's mail()-function as ist connects and disconnects to the mailserver for every mail sent. 你应该避免使用php的mail() - 函数ast连接并断开邮件服务器发送的每封邮件。

instead of that, try to use something like phpMailer wich allows easy configuration and sending a lot of mails without performance-problems. 而不是那样,尝试使用类似phpMailer的东西, 允许轻松配置并发送大量邮件而不会出现性能问题。

如果您想运行自己的邮件服务器(例如,如果这是一个开发环境),您可以使用

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM