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

时间:2022-02-11 15:24:41

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

这是我收到的错误。警告:邮件()函数。:在“localhost”端口25连接到mailserver失败,请在php中验证您的“SMTP”和“smtp_port”设置。或者使用ini_set() in D:\inetpub\vhosts\southernbatteries.com\httpdocs\在6行数组中包含\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. E.g Gmails mail server to send the mail ?

这到底意味着什么?这是否意味着我的web服务器上没有安装邮件服务器?是否可以使用不同的邮件服务器。E。ggmail邮件服务器发送邮件?

5 个解决方案

#1


4  

If you want to use built-in mail(), you will need to talk to the server administrator. 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.

如果您想使用内置的mail(),您将需要与服务器管理员对话。可以在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服务器进行通信,或者使用SwiftMailer这样的邮件包,可以直接连接到第三方SMTP服务器(如GMail)。

#2


0  

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. Note that this will only work depending on your ISP.

您需要一个邮件服务器来发送邮件。如果只有apache,就不能这样做,除非编辑php。将smpt_server设置为允许您这样做的文件。请注意,这只会根据您的ISP工作。

If you have a hosting account you can upload the files and online they will work.

如果你有一个托管帐户你可以上传文件和在线他们将工作。

#3


0  

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. You could try using your providers mail server. Or googles. But you need most likely a username and password for that.

我可以看到你在windows上运行它很可能是以后。您可以尝试使用提供程序邮件服务器。或者谷歌。但是你需要一个用户名和密码。

#4


0  

you should avoid using php's mail()-function as ist connects and disconnects to the mailserver for every mail sent.

您应该避免使用php的mail()函数作为ist连接,并在每次发送邮件时断开与邮件服务器的连接。

instead of that, try to use something like phpMailer wich allows easy configuration and sending a lot of mails without performance-problems.

与之相反,试着使用phpMailer wich之类的东西来简化配置并发送大量没有性能问题的邮件。

#5


0  

If you want to run your own mail server (if this is a development environment for example) you could use mercury.

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

#1


4  

If you want to use built-in mail(), you will need to talk to the server administrator. 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.

如果您想使用内置的mail(),您将需要与服务器管理员对话。可以在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服务器进行通信,或者使用SwiftMailer这样的邮件包,可以直接连接到第三方SMTP服务器(如GMail)。

#2


0  

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. Note that this will only work depending on your ISP.

您需要一个邮件服务器来发送邮件。如果只有apache,就不能这样做,除非编辑php。将smpt_server设置为允许您这样做的文件。请注意,这只会根据您的ISP工作。

If you have a hosting account you can upload the files and online they will work.

如果你有一个托管帐户你可以上传文件和在线他们将工作。

#3


0  

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. You could try using your providers mail server. Or googles. But you need most likely a username and password for that.

我可以看到你在windows上运行它很可能是以后。您可以尝试使用提供程序邮件服务器。或者谷歌。但是你需要一个用户名和密码。

#4


0  

you should avoid using php's mail()-function as ist connects and disconnects to the mailserver for every mail sent.

您应该避免使用php的mail()函数作为ist连接,并在每次发送邮件时断开与邮件服务器的连接。

instead of that, try to use something like phpMailer wich allows easy configuration and sending a lot of mails without performance-problems.

与之相反,试着使用phpMailer wich之类的东西来简化配置并发送大量没有性能问题的邮件。

#5


0  

If you want to run your own mail server (if this is a development environment for example) you could use mercury.

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