Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/280.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 服务器和本地主机上的SMTP邮件错误_Php_Email_Smtp - Fatal编程技术网

Php 服务器和本地主机上的SMTP邮件错误

Php 服务器和本地主机上的SMTP邮件错误,php,email,smtp,Php,Email,Smtp,我在zoho.com有一个电子邮件帐户,已配置并正在运行。在GoDaddy上,我托管了我的网站,并配置了我的邮件,以便zoho mail接收通过网站发送的任何邮件。直到上周,这套装置运行良好。现在我遇到了错误,我不知道是什么触发了它们 当我尝试向任何帐户发送邮件时,GoDaddy服务器上出现以下错误: SMTP->错误:无法连接到服务器:连接被拒绝(111) SMTP错误:无法连接到SMTP主机 对于同一脚本,localhost上出现以下错误: SMTP->错误:无法连接到服务器:尝试连接 失败

我在zoho.com有一个电子邮件帐户,已配置并正在运行。在GoDaddy上,我托管了我的网站,并配置了我的邮件,以便zoho mail接收通过网站发送的任何邮件。直到上周,这套装置运行良好。现在我遇到了错误,我不知道是什么触发了它们

当我尝试向任何帐户发送邮件时,GoDaddy服务器上出现以下错误:

SMTP->错误:无法连接到服务器:连接被拒绝(111) SMTP错误:无法连接到SMTP主机

对于同一脚本,localhost上出现以下错误:

SMTP->错误:无法连接到服务器:尝试连接 失败,因为关联方在发生错误后没有正确响应 一段时间,或由于已连接而建立的连接失败 主机无法响应。(10060)

我已尝试通过以下方法更正错误(在localhost和GoDaddy上):

  • 将端口号更改为25465和587

  • 已将smtp服务器从smtp.zoho.com更改为relay-hosting.secureserver.net

  • 将ssl更改为tls,反之亦然

  • 完全删除了SMTPSecure参数

  • 将超时变量增加到1000

  • 已验证邮件帐户是否存在,并且已启动并正在运行

  • 已验证邮件帐户是否具有有效的密码和用户名

可以找到一个正在运行的演示。我已经重复了错误以及为了这个问题而发送的消息

编辑1我注释掉了“$mail->Host=“smtp.zoho.com”,并得到以下错误:

SMTP->来自服务器:SMTP->来自服务器:SMTP->错误:EHLO not 已接受来自服务器:SMTP->来自服务器:SMTP->错误:HELO not 已从服务器接受:SMTP->错误:未从服务器接受身份验证: SMTP->注意:检查是否连接SMTP时捕获EOF错误: 无法进行身份验证

这是否意味着GoDaddy没有验证凭据

编辑2:我在zoho mail上的设置是:

传入服务器:poppro.zoho.com,端口:995,SSL(POP)
传入服务器:imappro.zoho.com,端口:993,SSL(IMAP)传出 服务器:smtp.zoho.com,端口:465,SSL(POP和IMAP)


尝试使用以下代码:

<?php
require_once('class.phpmailer.php');
//include("class.smtp.php"); // optional, gets called from within class.phpmailer.php if not already loaded

$mail = new PHPMailer(true); // the true param means it will throw exceptions on errors, which we need to catch

$mail->IsSMTP(); // telling the class to use SMTP

try {
    //SMTP needs accurate times, and the PHP time zone MUST be set
    //This should be done in your php.ini, but this is how to do it if you don't have access to that
    #require '../PHPMailerAutoload.php';

    //Create a new PHPMailer instance
    $mail = new PHPMailer;

    //Tell PHPMailer to use SMTP
    $mail->isSMTP();
    //Enable SMTP debugging
    // 0 = off (for production use)
    // 1 = client messages
    // 2 = client and server messages
    $mail->SMTPDebug = 3;

    //Ask for HTML-friendly debug output
    $mail->Debugoutput = 'html';

    //Set the hostname of the mail server
    $mail->Host = 'smtp.zoho.com';

    // use
    // $mail->Host = gethostbyname('smtp.zoho.com');
    // if your network does not support SMTP over IPv6

    //Set the SMTP port number - 587 for authenticated TLS, a.k.a. RFC4409 SMTP submission
    $mail->Port = 465;

    //Set the encryption system to use - ssl (deprecated) or tls
    //$mail->SMTPSecure = 'tls';

    //Whether to use SMTP authentication
    $mail->SMTPAuth = true;

    //Username to use for SMTP authentication - use full email address for gmail
    $mail->Username = "care@subillion.com";

    //Password to use for SMTP authentication
    $mail->Password = "care@subillion";

    //Set who the message is to be sent from
    $mail->setFrom('care@subillion.com', 'care@subillion.com');

    //Set an alternative reply-to address
    #$mail->addReplyTo('replyto@example.com', 'First Last');

    //Set who the message is to be sent to
    $mail->AddAddress($touser, $username);

    $mail->Subject = $subject;
    $mail->AltBody = "To view the message, please use an HTML compatible email viewer!";
    $mail->MsgHTML($msg);
    echo $msg;
    //$mail->AddAttachment('img/logo-dark.png');      
    $mail->Send();

    // echo "Message Sent OK</p>\n";
} catch (Exception $e) {
    // echo $e->getMessage(); //Boring error messages from anything else!
}
?>

尝试使用以下代码:

<?php
require_once('class.phpmailer.php');
//include("class.smtp.php"); // optional, gets called from within class.phpmailer.php if not already loaded

$mail = new PHPMailer(true); // the true param means it will throw exceptions on errors, which we need to catch

$mail->IsSMTP(); // telling the class to use SMTP

try {
    //SMTP needs accurate times, and the PHP time zone MUST be set
    //This should be done in your php.ini, but this is how to do it if you don't have access to that
    #require '../PHPMailerAutoload.php';

    //Create a new PHPMailer instance
    $mail = new PHPMailer;

    //Tell PHPMailer to use SMTP
    $mail->isSMTP();
    //Enable SMTP debugging
    // 0 = off (for production use)
    // 1 = client messages
    // 2 = client and server messages
    $mail->SMTPDebug = 3;

    //Ask for HTML-friendly debug output
    $mail->Debugoutput = 'html';

    //Set the hostname of the mail server
    $mail->Host = 'smtp.zoho.com';

    // use
    // $mail->Host = gethostbyname('smtp.zoho.com');
    // if your network does not support SMTP over IPv6

    //Set the SMTP port number - 587 for authenticated TLS, a.k.a. RFC4409 SMTP submission
    $mail->Port = 465;

    //Set the encryption system to use - ssl (deprecated) or tls
    //$mail->SMTPSecure = 'tls';

    //Whether to use SMTP authentication
    $mail->SMTPAuth = true;

    //Username to use for SMTP authentication - use full email address for gmail
    $mail->Username = "care@subillion.com";

    //Password to use for SMTP authentication
    $mail->Password = "care@subillion";

    //Set who the message is to be sent from
    $mail->setFrom('care@subillion.com', 'care@subillion.com');

    //Set an alternative reply-to address
    #$mail->addReplyTo('replyto@example.com', 'First Last');

    //Set who the message is to be sent to
    $mail->AddAddress($touser, $username);

    $mail->Subject = $subject;
    $mail->AltBody = "To view the message, please use an HTML compatible email viewer!";
    $mail->MsgHTML($msg);
    echo $msg;
    //$mail->AddAttachment('img/logo-dark.png');      
    $mail->Send();

    // echo "Message Sent OK</p>\n";
} catch (Exception $e) {
    // echo $e->getMessage(); //Boring error messages from anything else!
}
?>


假设您已经更改了上面的密码。不,电子邮件和密码与问题中提到的一样。在我看来:(在try block$mail->Mailer='smtp'中再添加一个参数;@RahulSingh无更改!godaddy服务器上出现相同错误:(如果您注释掉主机(zoho mx),您可能会默认尝试通过本地主机发送邮件,这可能不是您想要的。我们假设您已更改了上面的密码。不,电子邮件和密码与问题中提到的相同。在我看来:(在try block$mail->Mailer='smtp'中再添加一个参数;@RahulSingh无更改!godaddy服务器上出现相同错误:(如果您注释掉主机(zoho mx),您可能会默认尝试通过本地主机发送邮件,这可能不是您所希望的。谢谢您的回答。不幸的是,我在GoDaddy上收到了与您的脚本相同的错误。我认为这可能是因为没有正确调用文件,所以为了检查脚本是否确实可以与主机通信,我将退出“$mail->Host”"。我改为:SMTP->FROM SERVER:SMTP->FROM SERVER:SMTP->ERROR:EHLO not accepted FROM SERVER:SMTP->FROM SERVER:SMTP->ERROR:HELO not accepted FROM SERVER:SMTP->ERROR:AUTH not accepted FROM SERVER:SMTP->注意:在检查connectedSMTP错误:无法验证时捕获EOF。我认为您没有正确的电子邮件地址配置设置。请参阅我编辑的答案。我在哪里可以找到这些设置?还有,这些设置的SSL设置是什么?登录到cpanel>转到电子邮件帐户>单击电子邮件帐户>配置。然后您将找到这些详细信息。我无法更改我的POP/IMAP设置!感谢您的回答。很遗憾,我在GoD上收到了与您的脚本相同的错误我认为这可能是因为没有正确调用文件,所以为了检查脚本是否确实可以与主机通信,我注释掉了“$mail->host”。我改为:SMTP->FROM SERVER:SMTP->FROM SERVER:SMTP->ERROR:EHLO not accepted FROM SERVER:SMTP->FROM SERVER:SMTP->ERROR:HELO not accepted FROM SERVER:SMTP->ERROR:AUTH not accepted FROM SERVER:SMTP->注意:在检查connectedSMTP错误:无法验证时捕获EOF。我认为您没有正确的电子邮件地址配置设置。请参阅我编辑的答案。我在哪里可以找到这些设置?还有,相同的SSL设置是什么?登录到cpanel>转到电子邮件帐户>单击电子邮件帐户>配置。然后您将找到这些详细信息。我无法更改我的POP/IMAP设置!