如何检查PHP邮件()是否启用? [英] How to check if PHP mail() is enabled?

查看:174
本文介绍了如何检查PHP邮件()是否启用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在Microsoft服务器上安装一个PHP站点。由于某种原因,主持人不允许网站发送电子邮件。主持人给我发了一个代码示例...没有工作。

I need to install a PHP site on a Microsoft server. For some reason the host isn't allowing the site to send e-mails. The host has sent me a code sample... which didn't work.

有没有办法检查服务器是否允许通过php发送电子邮件mail()函数?

Is there a way to check if the server allows sending of e-mails through the php mail() function?

在这个阶段,这是关于手指指向,我需要一些证明来向客户端显示主机是否有故障。

At this stage it is all about finger pointing and I need some proof here to show the client that the host is at fault.

推荐答案

在Linux中,默认情况下,mail()函数使用来自操作系统的sendmail。

In Linux, by default mail() function uses sendmail from operating system.

在Windows中,默认情况下,mail()不执行任何操作,您必须将其设置为编辑php.ini文件。

In Windows, by default mail() doesn't do anything, you have to set it up editing php.ini file.

您可以从php中检查哪些选项。 ini你的主机正在使用,写一个showinfo.php文件,并在里面写:

You can check what options from php.ini your hosting is using, writing a showinfo.php file, and inside it, write:

   <?php
   phpinfo();
   ?>

然后,如果您打电话给该网页,它将显示所有已启用的选项。

Then if you call that webpage, it will show you all enabled options.

为了能够在Windows上发送邮件,这两个值应该像这样设置:

To be able to send mail on Windows, these two values should be set up similar like these:

SMTP = smtp.isp.net (the name or ip of your server)
sendmail_from = me@isp.net

XAMPP平台附带一个mailtodisk替换,您也可以通过SMTP连接将其设置为使用fakemail代替sendmail。您可以使用XAMPP附带的sendmail文件夹,并将其设置为IIS使用的php.ini。

XAMPP platform comes with a mailtodisk replacement, and you can set it to use "fakemail" in place of sendmail, also by means of an SMTP connection. You can take the sendmail folder that comes with XAMPP, and set it up in the php.ini that IIS uses.

这篇关于如何检查PHP邮件()是否启用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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