webkolikabi adlı üyeden alıntı: mesajı görüntüle
bu hatayı verdi hocam HTTP ERROR 500
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);

// Composer kullanıyorsanız
require_once 'vendor/autoload.php';

// Manuel yükleme için
require_once __DIR__ . '/phpmail/PHPMailer.php';
require_once __DIR__ . '/phpmail/SMTP.php';
require_once __DIR__ . '/phpmail/Exception.php';

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

// POST kontrolü
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    $AdiSoyadi = trim(strip_tags($_POST['AdiSoyadi'] ?? ''));
    $MailAdresi = trim(strip_tags($_POST['MailAdresi'] ?? ''));
    $MesajKonusu = trim(strip_tags($_POST['MesajKonusu'] ?? ''));
    $Mesaj = trim(strip_tags($_POST['Mesaj'] ?? ''));

    if($AdiSoyadi && $MailAdresi && $MesajKonusu && $Mesaj) {
        
        // reCAPTCHA kontrolü
        if (!isset($_POST['g-recaptcha-response']) || empty($_POST['g-recaptcha-response'])) {
            die('Lütfen robot olmadığınızı doğrulayın.');
        }
        
        $captcha = $_POST['g-recaptcha-response'];
        $secretKey = "6LddeJMrAAAAANw5XOIXSBgiIoAdGC22L42rrToG";
        
        $verifyResponse = file_get_contents('https://www.google.com/recaptcha/api/siteverify?secret=' . $secretKey . '&response=' . $captcha);
        $responseData = json_decode($verifyResponse);
        
        if ($responseData->success) {
            try {
                $mail = new PHPMailer(true);
                $mail->isSMTP();
                $mail->Host = 'smtp.gmail.com';
                $mail->SMTPAuth = true;
                $mail->Username = 'benimmailim@gmail.com';
                $mail->Password = 'benimmailim';
                $mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS;
                $mail->Port = 587;
                
                $mail->setFrom($mail->Username, 'İletişim Formu');
                $mail->addAddress('benimmailim@gmail.com', 'Admin');
                $mail->isHTML(true);
                $mail->Subject = $MesajKonusu;
                $mail->Body = "<strong>Ad:</strong> $AdiSoyadi<br><strong>E-Posta:</strong> $MailAdresi<br><strong>Mesaj:</strong> $Mesaj";
                
                $mail->send();
                echo '<script>alert("Mail başarıyla gönderildi!"); window.location.href=""; </script>';
                
            } catch (Exception $e) {
                echo "Mail gönderme hatası: {$mail->ErrorInfo}";
            }
        } else {
            echo 'reCAPTCHA doğrulaması başarısız.';
        }
    } else {
        echo 'Lütfen tüm alanları doldurun.';
    }
} else {
    echo 'Geçersiz istek.';
}
?>