Php mailer error

Website URL

(please specify the URL of the site on which you are experiencing the problem)

Warning : require(phpmailer/src/Exception.php): Failed to open stream: No such file or directory in /home/vol14_5/infinityfree.com/if0_36157420/htdocs/form.php on line 5

Fatal error : Uncaught Error: Failed opening required ‘phpmailer/src/Exception.php’ (include_path=‘.:/usr/share/pear/’) in /home/vol14_5/infinityfree.com/if0_36157420/htdocs/form.php:5 Stack trace: #0 {main} thrown in /home/vol14_5/infinityfree.com/if0_36157420/htdocs/form.php on line 5

codes

<?php
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;

require 'phpmailer/src/Exception.php';
require 'phpmailer/src/PHPMailer.php';
require 'phpmailer/src/SMTP.php';

if (isset($_POST['gonder'])) {
    $mail = new PHPMailer(true);
    $mail->CharSet = 'UTF-8';

    $mail->IsSMTP();
    $mail->Host ='smtp.gmail.com';
    $mail->SMTPAuth = true;
    $mail->Username = 's*********@gmail.com';
    $mail->Password = '***********';
    $mail->SMTPSecure = 'tls';  // Değişiklik burada
    $mail->Port = 587;  // Port da değişiklik burada
    $mail->SMTPDebug = 0; // 0 veya 2 olarak ayarlayabilirsiniz
    $mail->setFrom('s***********@gmail.com');
    $mail->addAddress('s***********@gmail.com');

    $mail->isHtml(true);
    $mail->Subject = $_POST["adsoyad"];  // Değişiklik burada
    $mail->Body = $_POST["konu"] . "<br>Gönderen Kişi: " . $_POST["email"];


    $mail->Send();

    echo "
    <script> 
    alert('İleti başarıyla gönderildi');
    document.location.href ='index.php';
    </script>
    ";
}
else {
    echo "<script> 
    alert('İleti maalesef gönderilemedi');
    document.location.href ='index.php';
    </script>";
}

file locations are correct

Show the contents of this folder:

5 Likes

So does this file exist in this location? Because PHP says it doesn’t.

3 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.