【发布时间】:2014-02-06 20:36:56
【问题描述】:
我正在学习如何使用 php 发送邮件,所以我在 XAMPP 中本地测试它。我将 Mercury 用于我的邮件服务器,并使用 this guide 进行设置,但是当我尝试发送邮件时收到以下错误消息:
Warning: mail(): Failed to connect to mailserver at "grid2i-ent.seg.att.com" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in E:\xampp\htdocs\userSystem\etest.php on line 7
这是我的 PHP 代码:
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'From: root@localhost.com' . "\r\n";
mail("root@localhost.com", "Subject", "Hello", $headers);//This is line 7
这是我的 php.ini 邮件设置:
SMTP = grid2i-ent.seg.att.com
smtp_port = 25
【问题讨论】:
-
您的 SMTP 服务器可能有问题 - 您可以随时尝试其他服务器。