我试图通过使用PHP邮件通过PHP发送电子邮件,但它显示SMTP连接()失败。这是我的代码。无法找出那是什么问题。如果有人帮助追踪错误,那对我来说会非常有帮助。SMTP连接()失败。虽然发送身份验证电子邮件
$mail = new PHPMailer;
$mail->isSMTP(); // Set mailer to use SMTP
$mail->Host = 'dds.uemtv.com'; // Specify main and backup SMTP servers
$mail->SMTPAuth = true; // Enable SMTP authentication
$mail->Username = '[email protected]'; // SMTP username
$mail->Password = 'pssword'; // SMTP password
$mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted
$mail->Port = 587; // TCP port to connect to
$mail->setFrom('[email protected]', 'title');
$mail->addReplyTo($email, '$name');
$mail->addAddress($email); // Add a recipient
//$mail->addCC('[email protected]');
//$mail->addBCC('[email protected]');
$mail->isHTML(true); // Set email format to HTML
$bodyContent = '<h1>Your Registration Completed. </h1>'
$mail->Subject = 'Verify Account- Rozgar';
$mail->Body = $bodyContent;
if(!$mail->send()) {
echo $data->msg = $mail->ErrorInfo;
} else {
// echo 'Message has been sent';
echo $data->msg="Please Verify Your Email Address";
}
显示此错误。
2017-06-07 05:36:44 SERVER -> CLIENT: 220-dds.uemtv.com ESMTP Exim 4.89 #1 Wed, 07 Jun 2017 10:36:40 +0500 220-We do not authorize the use of this system to transport unsolicited, 220 and/or bulk e-mail.
2017-06-07 05:36:44 CLIENT -> SERVER: EHLO localhost
2017-06-07 05:36:44 SERVER -> CLIENT: 250-dds.uemtv.com Hello localhost [182.186.132.245] 250-SIZE 52428800 250-8BITMIME 250-PIPELINING 250-STARTTLS 250 HELP
2017-06-07 05:36:44 CLIENT -> SERVER: STARTTLS
2017-06-07 05:36:45 SERVER -> CLIENT: 220 TLS go ahead
2017-06-07 05:36:46 CLIENT -> SERVER: EHLO localhost
2017-06-07 05:36:47 SERVER -> CLIENT: 250-dds.uemtv.com Hello localhost [182.186.132.245] 250-SIZE 52428800 250-8BITMIME 250-PIPELINING 250-AUTH PLAIN LOGIN 250 HELP
2017-06-07 05:36:47 CLIENT -> SERVER: AUTH LOGIN
2017-06-07 05:36:47 SERVER -> CLIENT: 334 VXNlcm5hbWU6
2017-06-07 05:36:47 CLIENT -> SERVER: xxx=
2017-06-07 05:36:47 SERVER -> CLIENT: 334 UGFzc3dvcmQ6
2017-06-07 05:36:47 CLIENT -> SERVER: xxx
2017-06-07 05:36:49 SERVER -> CLIENT: 535 Incorrect authentication data
2017-06-07 05:36:49 SMTP ERROR: Password command failed: 535 Incorrect authentication data
2017-06-07 05:36:49 SMTP Error: Could not authenticate.
2017-06-07 05:36:49 CLIENT -> SERVER: QUIT
2017-06-07 05:36:50 SERVER -> CLIENT: 221 dds.uemtv.com closing connection
2017-06-07 05:36:50 SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
问题出现在日志中。来自SMTP服务器的消息:_“我们不授权使用此系统传输未经请求的,220和/或批量电子邮件”_。代码正常工作,你只是被SMTP服务器阻止。 –
我不认为这是错误,535错误的认证数据部分错误进一步下降。 –
@DavidFindlay哦,看看那个。您绝对正确:_“SMTP错误:无法进行身份验证。”_ –