<?php
error_reporting( E_ALL ^ E_NOTICE ^ E_STRICT ^ E_WARNING ^ E_DEPRECATED );
header('Access-Control-Allow-Origin: *');
require_once '../settings.php';
require_once '../_plugins/phpmailer/class.phpmailer.php';
require_once '../_plugins/phpmailer/class.smtp.php';

$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPAuth = true;
$mail->Host = $settings['email_host'];
$mail->Port = $settings['email_port'];
$mail->Username = $settings['email_login'];
$mail->Password = $settings['email_password'];
$mail->CharSet = "UTF-8";
$mail->IsHTML(true);
$mail->SMTPOptions = array(
  'ssl' => array(
    'verify_peer' => false,
    'verify_peer_name' => false,
    'allow_self_signed' => true
  )
);

$mail->SetFrom('www@projectpro.pl', 'ProjectPro');
// $mail->AddAddress('pyziak84@gmail.com');
// $mail->AddAddress('roman.pyrih@project-pro.pl', 'project.pro.rzeszow@wp.pl');
$mail->AddAddress('project.pro.rzeszow@wp.pl');

$mail->Subject = 'Test wysyłki HTML maila';

$mail->Body = file_get_contents('index.html');

if ($mail->Send()) {
    echo "✅ Email został wysłany.";
} else {
    echo "❌ Błąd podczas wysyłania: " . $mail->ErrorInfo;
}
?>