Initial commit: struttura base Diplomacy Web App con header/footer e auth

This commit is contained in:
2025-11-21 16:04:22 +00:00
commit 052b8182aa
17 changed files with 367 additions and 0 deletions

32
send_email.php Executable file
View File

@@ -0,0 +1,32 @@
<?php
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
require __DIR__ . '/vendor/autoload.php';
require __DIR__ . '/smtp_config.php';
function sendEmail($to, $subject, $body){
$mail = new PHPMailer(true);
try {
$mail->isSMTP();
$mail->Host = SMTP_HOST;
$mail->SMTPAuth = true;
$mail->Username = SMTP_USER;
$mail->Password = SMTP_PASS;
$mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS; // TLS
$mail->Port = SMTP_PORT;
$mail->setFrom(SMTP_FROM, SMTP_FROM_NAME);
$mail->addAddress($to);
$mail->isHTML(true);
$mail->Subject = $subject;
$mail->Body = $body;
$mail->send();
return true;
} catch (Exception $e) {
error_log("Mailer Error: ".$mail->ErrorInfo);
return false;
}
}