Error warning: stream_select() phpmailer

Saya buat test file untuk fitur validasi register email dengan PHPmailer test file saya

<?php

use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;

require 'phpmailer/autoload.php';

$mail = new PHPMailer(true);
try {
    //Server settings
	$mail->SMTPDebug  = 2;
	$mail->isSMTP();
	$mail->Host       = 'ssl://smtp.gmail.com';
	$mail->SMTPAuth   = true;
	$mail->Username   = 'xxxxx@gmail.com';
	$mail->Password   = 'xxxxx';
	$mail->SMTPSecure = 'tls';
	$mail->Port       = 465;

    //Recipients
    $mail->setFrom('xxxxx@gmail.com', 'Mailer');
    $mail->addAddress('yyyyy@gmail.com');     // Add a recipient

    //Content
    $mail->isHTML(true);
    $mail->Subject = 'Test';
    $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';

    $mail->send();
    echo 'Message has been sent';
} catch (Exception $e) {
    echo 'Message could not be sent. Mailer Error: ', $mail->ErrorInfo;
}

namun error menyebutkan

2019-02-02 10:49:28 SERVER -> CLIENT: 220 smtp.gmail.com ESMTP m9sm26082155pgd.32 - gsmtp
2019-02-02 10:49:28 CLIENT -> SERVER: EHLO 127.0.0.1

Warning: stream_select(): No stream arrays were passed in D:\Acode\web\www\pro\apsi-app\phpmailer\phpmailer\phpmailer\src\SMTP.php on line 1125
2019-02-02 10:49:29 SERVER -> CLIENT: 250-smtp.gmail.com at your service, [103.100.129.109]
SMTP Error: Could not authenticate.
2019-02-02 10:49:29 CLIENT -> SERVER: QUIT
2019-02-02 10:49:29 SERVER -> CLIENT: 250-SIZE 35882577250-8BITMIME250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH250-ENHANCEDSTATUSCODES250-PIPELINING250-CHUNKING250 SMTPUTF8
2019-02-02 10:49:29 SMTP ERROR: QUIT command failed: 250-SIZE 35882577250-8BITMIME250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH250-ENHANCEDSTATUSCODES250-PIPELINING250-CHUNKING250 SMTPUTF8
SMTP Error: Could not authenticate.
Message could not be sent. Mailer Error: SMTP Error: Could not authenticate.

Kira kira salahnya dimana mas? extension ssl sudah aktif, email & password pun sudah benar

avatar dimashpt
@dimashpt

39 Kontribusi 1 Poin

Diperbarui 3 tahun yang lalu

2 Jawaban:

Jawaban Terpilih

coba hohstnya "smtp.gmail.com" aja

kalau tidak bisa beberapa menyarankan ini:

Ke myaccount.google.com -> "Sign-in & security" -> "Apps with account access", and turn "Allow less secure apps" to "ON" (near the bottom of the page).

avatar hilmanski
@hilmanski

2670 Kontribusi 2132 Poin

Dipost 5 tahun yang lalu

SMTPSecure nya ssl, klo port yang dipakai 465 -> ssl, klo pakai port 587 baru 'tls'

avatar anggi86
@anggi86

1 Kontribusi 0 Poin

Dipost 3 tahun yang lalu

Login untuk ikut Jawaban