PHP Mailer错误 [英] PHP mailer error

查看:172
本文介绍了PHP Mailer错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试使用php mailer,但出现以下错误.

I tried to use php mailer but errors as follows.

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 -> NOTICE: EOF caught while checking if connectedSMTP Error: Could not authenticate. Message could not be sent.

Mailer Error: SMTP Error: Could not authenticate. 

和我的代码

 <?php
        require("class.phpmailer.php")
        $mail = new PHPMailer();        
        $mail->IsSMTP();                                    
        $mail->Host = "smtp.gmail.com";  
        $mail->Port = 465;        
        $mail->SMTPAuth = true;     

        $mail->SMTPDebug = 2;  
        $mail->Username = "admin@xxxxxxxxxxxx.in";  
        $mail->Password = "xxxxxxxx";   
        $mail->From = "admin@xxxxxxxxxxxx.in";
        $mail->FromName = "Mailer";
        $mail->AddAddress("xxxx@yahoo.co.in", "mine");               
        $mail->WordWrap = 50;                                 
        $mail->IsHTML(true);                                  

        $mail->Subject = "Here is the subject"  
        $mail->Body    = "This is the HTML message body <b>in bold!</b>";
        $mail->AltBody = "This is the body in plain text for non-HTML mail clients";


        if(!$mail->Send())  {
           echo "Message could not be sent. <p>";
           echo "Mailer Error: " . $mail->ErrorInfo;
           exit;
        }
        echo "Message has been sent";

        ?>

推荐答案

某些服务器(尤其是共享主机)将阻止您将SSL与SMTP一起使用,我曾经遇到过同样的问题.

Some servers (especially shared hosting) will block you from using SSL with SMTP, I had the same problem once.

请尽可能更改主机,尝试使用默认的PHP mail()函数或通过不需要SSL的其他邮件服务器发送邮件,例如端口25而不是465.

Either change host if you can, try using the default PHP mail() function or send through another mail server that does not require SSL e.g. port 25 not 465.

诸如 AuthSMTP 之类的东西将是备用邮件服务器的最佳选择.

Something like AuthSMTP would be your best bet for an alternate mail server.

这篇关于PHP Mailer错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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