Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/date/2.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
Email 邮件程序错误:使用phpmailer的SMTP connect()_Email_Phpmailer - Fatal编程技术网

Email 邮件程序错误:使用phpmailer的SMTP connect()

Email 邮件程序错误:使用phpmailer的SMTP connect(),email,phpmailer,Email,Phpmailer,我正在尝试使用PHPMailer发送邮件,但当我尝试时,会出现如下错误 MEssage Could not be sent. SMTP connect() failed 调试代码时,我收到以下消息: CLIENT -> SERVER: EHLO 127.0.0.1 CLIENT -> SERVER: AUTH LOGIN CLIENT -> SERVER: dGFsYWFzaDIwMTdAc29jZXQuZWR1Lmlu CLIENT -> SERVER: c29jZX

我正在尝试使用PHPMailer发送邮件,但当我尝试时,会出现如下错误

MEssage Could not be sent. SMTP connect() failed
调试代码时,我收到以下消息:

CLIENT -> SERVER: EHLO 127.0.0.1
CLIENT -> SERVER: AUTH LOGIN
CLIENT -> SERVER: dGFsYWFzaDIwMTdAc29jZXQuZWR1Lmlu
CLIENT -> SERVER: c29jZXRAMTIz
SMTP ERROR: Password command failed: 534-5.7.14 <https://accounts.google.com/signin/continue?sarp=1&scc=1&plt=AKgnsbt5534-5.7.14 V4dQliEGa4GCkfkxZoZVAX296_Q1jP9UHhiGXQShhTqxshYg2snLu2nKW4UIhB3k4X6Kqt534-5.7.14 Q6rvXHk5aNrXU22BwfYC_VVWeFwr8-216IZQmLpq0AA9NXNaQGQHeW1ZJNQGrvUBs6f8HQ534-5.7.14 OLspMG5dlPjNzvsAGG6lHHJ7eVYFFv8sZEYvxaAkvJR1zHk27qNpB1Gc5Ld32Fbs1SpC2H534-5.7.14 981OqnvjQrzYQCbcwIwVrqfjoVQPk> Please log in via your web browser and534-5.7.14 then try again.534-5.7.14 Learn more at534 5.7.14 https://support.google.com/mail/answer/78754 n79sm9364629pfj.31 - gsmtp
SMTP Error: Could not authenticate.
CLIENT -> SERVER: QUIT
SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
Message could not be sent.Mailer Error: SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
CLIENT->SERVER:EHLO 127.0.0.1
客户端->服务器:身份验证登录
客户端->服务器:dGFsYWFzaDIwMTdAc29jZXQuZWR1Lmlu
客户端->服务器:c29jZXRAMTIz
SMTP错误:密码命令失败:534-5.7.14请通过web浏览器和534-5.7.14登录,然后重试。534-5.7.14在534 5.7.14了解更多信息https://support.google.com/mail/answer/78754 n79sm9364629pfj.31-gsmtp
SMTP错误:无法进行身份验证。
客户端->服务器:退出
SMTP连接()失败。https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
无法发送邮件。邮件程序错误:SMTP connect()失败。https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
以下是我尝试过的代码:

require '../phpmailer/PHPMailerAutoload.php';
            $mail = new PHPMailer;

            //$mail->SMTPDebug = 3;                               // Enable verbose debug output
            $mail->isSMTP();
            $mail->SMTPDebug = 1;
            $mail->Debugoutput = 'html';
            $mail->Host = 'smtp.gmail.com';
            $mail->Port = 465;
            $mail->SMTPSecure = 'ssl';
            $mail->SMTPAuth = true;
            $mail->Username = 'mymail@gmail.com';                 // SMTP username
            $mail->Password = 'mypass';

            $mail->setFrom('mymail@gmail.com', 'Mailer');
            $mail->addAddress($user_email, $user_name);
            $mail->Subject = 'Registration acknowledgment GTU Techfest Zone - 1';
            $mail->Body    = '<b>You have registerd for following events:</b>'."\r\n";

            if(!$mail->send()) 
            {
                echo 'Message could not be sent.';
                echo 'Mailer Error: ' . $mail->ErrorInfo;
            } else {
                echo 'Message has been sent';
            }
            }
            else
            {
                echo "unsuccessfull".mysql_error();
            }
require'../phpmailer/phpmailerautoad.php';
$mail=新的PHPMailer;
//$mail->SMTPDebug=3;//启用详细调试输出
$mail->isSMTP();
$mail->SMTPDebug=1;
$mail->Debugoutput='html';
$mail->Host='smtp.gmail.com';
$mail->Port=465;
$mail->SMTPSecure='ssl';
$mail->SMTPAuth=true;
$mail->Username=mymail@gmail.com';                 // SMTP用户名
$mail->Password='mypass';
$mail->setFrom('mymail@gmail.com","梅勒",;
$mail->addAddress($user\u email,$user\u name);
$mail->Subject='注册确认GTU Techfest区域-1';
$mail->Body='您已经为以下事件注册了:'。“\r\n”;
如果(!$mail->send())
{
echo“无法发送消息”;
回显“邮件错误:”。$mail->ErrorInfo;
}否则{
回音“消息已发送”;
}
}
其他的
{
echo“unsuccessfull”.mysql_error();
}

我试过几种解决办法,但都不管用我正在使用localhost。我还更改了我的xampp设置,以便在发布之前发送邮件

可能重复的搜索