<?php
// ─── Mail Configuration ──────────────────────────────────────────────────────
if (realpath(__FILE__) == realpath($_SERVER['SCRIPT_FILENAME'])) {
    header('HTTP/1.0 403 Forbidden', true, 403);
    exit;
}

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

// Run `composer install` in this directory before deploying — PHPMailer is
// pulled in via composer.json rather than vendored directly in this repo.
require_once __DIR__ . '/../vendor/autoload.php';

define('MAIL_HOST',     'smtp.hostinger.com');
define('MAIL_USER',     'info@host25cent.com');
define('MAIL_PASS',     'Il0veu0k@@@');
define('MAIL_PORT',     587);
define('MAIL_SECURE',   'tls');

function make_mailer($from, $fromName, $replyTo = null) {
    $mail = new PHPMailer();
    $mail->IsSMTP();
    $mail->SMTPDebug  = 0;
    $mail->SMTPAuth   = true;
    $mail->SMTPSecure = MAIL_SECURE;
    $mail->Port       = MAIL_PORT;
    $mail->Username   = MAIL_USER;
    $mail->Password   = MAIL_PASS;
    $mail->Host       = MAIL_HOST;
    $mail->Mailer     = 'smtp';
    $mail->SetFrom($from, $fromName);
    if ($replyTo) {
        $mail->AddReplyTo($replyTo, $fromName);
    }
    return $mail;
}