<?php
require_once 'PHPMailer/src/Exception.php';
require_once 'PHPMailer/src/PHPMailer.php';
require_once 'PHPMailer/src/SMTP.php';

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

$mail = new PHPMailer(true);
try {
    $mail->isSMTP();
    $mail->Host       = 'localhost';
    $mail->SMTPAuth   = true;
    $mail->Username   = 'info@rishtasite.in';
    $mail->Password   = 'Sailor@12345';
    $mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS;
    $mail->Port       = 465;
    $mail->CharSet    = 'UTF-8';
    $mail->SMTPOptions = array(
        'ssl' => array(
            'verify_peer'       => false,
            'verify_peer_name'  => false,
            'allow_self_signed' => true
        )
    );

    $mail->setFrom('info@rishtasite.in', 'Rishta Depot');
    $mail->addReplyTo('info@rishtasite.in', 'Rishta Depot');
    $mail->addAddress('ak1804309@gmail.com', 'Admin');
    $mail->isHTML(true);
    $mail->Subject = 'Rishta Depot CRM Test - ' . date('d M Y H:i:s');
    $mail->Body    = '
    <html>
    <body style="font-family:Arial,sans-serif;padding:20px;">
        <h2 style="color:#f36f21;">Test Email from Rishta Depot CRM</h2>
        <p>This is a test email sent at: <strong>' . date('d M Y H:i:s') . '</strong></p>
        <p>If you received this, your email system is working correctly!</p>
        <hr>
        <p style="color:#888;font-size:12px;">Rishta Depot CRM System</p>
    </body>
    </html>';
    $mail->AltBody = 'Test email from Rishta Depot CRM sent at: ' . date('d M Y H:i:s');

    $mail->send();
    echo '✅ SUCCESS — Email sent! Check Gmail inbox AND spam folder.';
    echo '<br>Sent at: ' . date('d M Y H:i:s');

} catch (Exception $e) {
    echo '❌ FAILED: ' . $mail->ErrorInfo;
}
?>Sailor@12345