Merhabalar üstadlar,
phpmailer de bağlantı hatası alıyorum küçük bir ödev yapmam gerekiyor yardımcı olursanız çok minnettar olurum
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
require 'PHPMailer/src/Exception.php';
require 'PHPMailer/src/PHPMailer.php';
require 'PHPMailer/src/SMTP.php';
$mail = new PHPMailer(true);
try{
$mail->isSMTP();
$mail->SMTPKeepAlive = true;
$mail->SMTPAuth = true;
$mail->SMTPSecure = 'tls'; //ssl
$mail->Port = 587; //25 , 465 , 587
$mail->Host = "smtp.gmail.com";
$mail->UserName = "demo@gmail.com";
$mail->Password = "sifre";
$mail->setFrom("alici@gmail.com");
$mail->addAddress("alici@gmail.com");
$mail->isHTML(true);
$mail->Subject = "Gmail SMTP Ornegi";
$mail->Body = "<h1>Merhaba </h1><p>Bu bir denemedir.</p>";
#$mail->addAttachment("dosya.txt");
$mail->send();
echo 'Message has been sent';
} catch (Exception $e) {
echo "Message could not be sent. Mailer Error: {$mail->ErrorInfo}";
}Almış olduğum hata
Message could not be sent. Mailer Error: SMTP Error: Could not authenticate.SMTP server error: Called RSET without being connected