Jho*_* H. 12
要检查/更改PHP邮件配置:
打开你的php.ini文件(如果你不知道它在哪里,见下文)搜索读取[mail function]的行添加/更改邮件服务器的详细信息.这可以是本地邮件服务器或ISP的邮件服务器.保存/关闭php.ini文件重新启动Web服务器
第一次打开php.ini文件时邮件设置的示例:
[mail function]
; For Win32 only.
SMTP = localhost
smtp_port = 25
; For Win32 only.
;sendmail_from = me@example.com
; For Unix only. You may supply arguments as well (default: "sendmail -t -i").
;sendmail_path =
Run Code Online (Sandbox Code Playgroud)
其他信息在回显phpinfo()您可以查看您的PHP配置详细信息.您可以通过创建一个带有以下行的.php文件来完成此操作:<?php phpinfo(); ?>.在浏览器中运行它时,您将看到PHP配置变量的完整列表.只需搜索包含php.ini的行并sendmail_path查看您需要使用的值.
另一个想法是你可能会使用ini_set()这样正确配置你的邮件设置
如果邮件脚本继续失败,请将以下代码添加到电子邮件脚本的顶部.
// Please specify your Mail Server - Example: mail.example.com.
ini_set("SMTP","mail.example.com");
// Please specify an SMTP Number 25 and 8889 are valid SMTP Ports.
ini_set("smtp_port","25");
// Please specify the return address to use
ini_set('sendmail_from', 'example@YourDomain.com');
Run Code Online (Sandbox Code Playgroud)