PHPMailer错误,SMTP连接()失败

PHPMailer错误,SMTP连接()失败,php,phpmailer,Php,Phpmailer,你能帮我解决这个问题吗?我在脚本中设置了phpmailer。我遇到SMTPconnect()失败错误。我正在使用XAMPP <?php require_once '../beta/mailer/PHPMailerAutoload.php'; $mail = new PHPMailer; $mail->isSMTP(); $mail->SMTPDebug = 2; $mail->Debugoutput = 'html';

你能帮我解决这个问题吗?我在脚本中设置了phpmailer。我遇到SMTP
connect()失败错误
。我正在使用XAMPP

<?php
    require_once '../beta/mailer/PHPMailerAutoload.php';
    $mail = new PHPMailer;   
    $mail->isSMTP();
    $mail->SMTPDebug = 2;
    $mail->Debugoutput = 'html';
    $mail->Host = "localhost";
    $mail->Port = 465;
    $mail->SMTPAuth = false;
    $mail->setFrom('root@localhost','SetupFileRequestFormDatabase');
    $mail->addAddress($email);    
    $mail->Subject = 'CONFIDENTIAL: LOG-IN CREDENTIALS';
    $mail->Body ="USERNAME: $username <br/>
                PASSWORD: $pw <br/>
                Setup File Request Form link: http://cavwdb01/SetUpFileForm/index.php <br/>
                *************************************************** <br/>
                THIS IS AN AUTOMATED MESSAGE.  PLEASE DO NOT REPLY.";                           
    $mail->AltBody = 'This is a plain-text message body';    
    if (!$mail->send()) {
        echo "Error: " . $mail->ErrorInfo;
    }
?>


您是否在本地主机和侦听端口465上运行SMTP服务器?如果您是通过本地主机发送,您最好使用
isMail()
isSendmail()
而不是
isSMTP()