fatal error(): Failed opening required "path" (include_path='C:\xampp\php\PEAR') in phpmailer

Viewed 86

I am new to PHP and I want to create a web app, which can send an OTP to the user's email. everything is working as expected, when I provide an email to the input and click send OTP, it registers the email to the database and even redirects to the next page where it shows this error:

Warning: require(D:\Suggest_Random_Comic-main<D:>Suggest_Random_Comic-main/vendor/autoload.php): failed to open stream: No such file or directory in D:\Suggest_Random_Comic-main\SendMailConfig.php on line 6

This is the snapshot of the error: error snapshot

Fatal error: require(): Failed opening required 'D:\Suggest_Random_Comic-main<D:>Suggest_Random_Comic-main/vendor/autoload.php' (include_path='C:\xampp\php\PEAR') in D:\Suggest_Random_Comic-main\SendMailConfig.php on line 6

SendMailConfig.php:

<?php  
    use PHPMailer\PHPMailer\PHPMailer;
    //require '..D:/Suggest_Random_Comic-main/vendor/phpmailer/phpmailer/src/PHPMailer.php';
    //require '..D:/Suggest_Random_Comic-main/vendor/phpmailer/phpmailer/src/SMTP.php';
    //require '..D:/Suggest_Random_Comic-main/vendor/phpmailer/phpmailer/src/Exception.php';
    require __DIR__.'D:/Suggest_Random_Comic-main/vendor/autoload.php';
    require __DIR__.'/vendor/class.phpmailer.php';
    require __DIR__.'/vendor/class.smtp.php';

    $mail = new PHPMailer(true);
    $mail->SMTPDebug = 0;                                       
    $mail->isSMTP();                                            
    $mail->Host       = 'smtp.gmail.com;';                    
    $mail->SMTPAuth   = true;                             
    $mail->Username   = 'luvsharma.2509@gmail.com';                 
    $mail->Password   = 'dkMXj3@1';                        
    $mail->SMTPSecure = 'tls';                              
    $mail->Port       = 587;  
    $mail->setFrom($mail->Username, 'System');          
?>
0 Answers
Related