我无法使用PHPMailer发送电子邮件

我无法使用PHPMailer发送电子邮件,php,email,smtp,phpmailer,Php,Email,Smtp,Phpmailer,这是我第一次参加这个论坛, 我希望你能帮助我 问题是我无法使用PHPmailer发送电子邮件 代码: class Controller_Mail extends Controller_Template{ protected $oMailer; public function __construct() { $this->oMailer = new PHPMailer(true); } //Envoyer Password Oublie à un candidat publ

这是我第一次参加这个论坛, 我希望你能帮助我

问题是我无法使用PHPmailer发送电子邮件

代码:

class Controller_Mail extends Controller_Template{
protected $oMailer;

public function __construct()
{

    $this->oMailer = new PHPMailer(true);
}

//Envoyer Password Oublie à un candidat  
public function EnvoyerPasswordOublie(Class_Candidat $objCandidat){
    try {

        $nom                 = $objCandidat->getNomPrenom() ;
        $password            = $objCandidat->getPassword() ;
        //$toMailCandidat      = $objCandidat->getMail() ;
        $toMailCandidat      = "amaljob@gmail.com" ;
        $subject             = "Mot de passe oublié !" ;    
        $message             = "Cher (e) <b>".html($nom)."</b>,<br/> <br/> 
                                Suite à votre demande, veuillez trouver ci-dessous votre identifiant et votre mot de passe, vous permettant d'accéder à votre espace :<br/><br/>
                                Email : ".html($toMailCandidat)."<br/>
                                Mot de passe : ".$password."<br/><br/>
                                Cordialement,,<br/><br/>
                                L’Equipe ".ABREV ;
        //$message             = templateStringCandidat($message) ;
        $message             = "message" ;

        $this->oMailer->IsSMTP();
        $this->oMailer->SMTPAuth   = true;
        $this->oMailer->SMTPDebug  = 2;
        $this->oMailer->Port       = 485;
        $this->oMailer->FromName   = ABREV;
        $this->oMailer->From       = MailsFrom;
        $this->oMailer->AddAddress($toMailCandidat);
        $this->oMailer->AddAddress(MailNotifications);
        $this->oMailer->AddReplyTo(MailsFrom,ABREV);
        $this->oMailer->Subject    = $subject;
        $this->oMailer->MsgHTML($message);
        $this->oMailer->IsHTML(true); // send as HTML 




        if(!$this->oMailer->Send()) {
            return 'erreur : '.$this->oMailer->ErrorInfo;
        } else {
            return true;
        }

    } catch (phpmailerException $e) {
        return false;
    }   
}
}

结果是错误的

注意:我已经在PHPMailer类中配置了SMTP身份验证

关于信息,我的网站是DEMO,我把它放在一个子目录www.domain.com/subdirectory

尝试使用$this->oMailer->SMTPDebug=SMTP::DEBUG\u LOWLEVEL//SMTP::DEBUG_LOWLEVEL=4


此值输出更多有关可能错误的信息

以及发送函数中的内容?@Pogrindis…->Send;是一个内置的PHPMailer函数。它不需要修改。$this->oMailer=new PHPMailer;应该是第一行。您能提供一些关于您的环境的详细信息吗,例如您是否在Windows或Linux IIS、Apache、Nginx等上运行。。。?这是您自己的服务器、共享主机、VPS还是专用服务器?您是否配置了默认邮件服务器环境?…$this->oMailer->ErrorInfo是什么意思?谢谢您,answar,我尝试使用$this->oMailer->SMTPDebug=SMTP::DEBUG\u LOWLEVEL;然后我得到了500个内部服务器错误。奇怪的是,我在另一个网站上使用了相同配置的phpmailer,而且效果很好!唯一的区别是,其他网站在子域和这个网站演示在一个子目录这可能是问题?!我也尝试过这个方法,但结果总是错误的,错误信息是空的。我为最新版本编写了低级别调试的代码,它必须工作-尝试更新您的版本。子域或子文件夹无法创建该问题