Everything else is OK, but I can't send email for some reason:
<?php    
$msg="";
use PHPMailer\PHPMailer\PHPMailer;
include_once "PHPMailer/PHPMailer.php";
include_once "PHPMailer/Exception.php";
if(isset($_POST['submit'])) {
    $subject=$_POST['subject'];
    $email=$_POST['email'];
    $message=$_POST['message'];
   
    $mail= new PHPMailer();
 
     $mail->AddAddress('nkhlpatil647@gmail.com', 'First Name');
     $mail->SetFrom('nkhlpatil647@gmail.com','admin');
  
    $mail->Subject = $subject; 
   $mail->isHTML(true); 
   $mail->Body=$message;
    
    if($mail->send())
        $msg="Your rmail msg has been send";
     else
       $msg="mail msg has not been send";
}
?>
The $mail->send() function always goes to the else part. What am I doing wrong?
 
     
     
     
    