<?php

header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: POST');
header('Access-Control-Allow-Headers: Origin, Content-Type, X-Auth-Token');

//Load Composer's autoloader
require 'vendor/autoload.php';
require_once 'util/mailer-info.php';

$smtpHost = 'smtp.host.com';
$smtpEmail = 'sender@domain.com';
$smtpPassword = 'Password';
$logReceiver = 'receiver@domain.com';

// Check if the request method is POST and content type is JSON
if ($_SERVER["REQUEST_METHOD"] == "POST" && $_SERVER["CONTENT_TYPE"] === "application/json") {
    senderMail($smtpHost, $smtpEmail, $smtpPassword, $logReceiver);

} else {
    echo 'Invalid request method or content type';
}