fixed mailer class

This commit is contained in:
2026-09-04 10:03:38 +02:00
parent 83af2e2d17
commit b8957a8a24
15 changed files with 479 additions and 631 deletions
+19 -23
View File
@@ -1,17 +1,18 @@
<?php
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
?>
<?php
// Connessione al database (adattare le informazioni di connessione)
include('include/headscript.php');
require_once __DIR__ . '/class/mailer.php';
$conn = new mysqli($servername, $username, $password, $dbname);
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
$conn = $bkngstm; // riusa la connessione già aperta da bkngstm.php
// Recupera il parametro "idbookingclass" dalla richiesta GET
// Recupera il parametro "idbookingclass" dalla richiesta GET
if (isset($_GET['idbookingclass'])) {
$idbookingclass = $_GET['idbookingclass'];
$idbookingclass = (int) $_GET['idbookingclass'];
// Aggiorna lo status a "booked" e is_reprogrammed a "Y" nella tabella "bookingclass"
$query = "UPDATE bookingclass SET status = 'booked', is_reprogrammed = 'Y' WHERE idbookingclass = ?";
@@ -38,9 +39,7 @@ if (isset($_GET['idbookingclass'])) {
$firstname = $row['first_name'];
$newtimeformat = date("d-m-Y H:i", strtotime($newtime));
require 'phpmailer/src/Exception.php';
require 'phpmailer/src/PHPMailer.php';
require 'phpmailer/src/SMTP.php';
// Mail to client
$messageedit = "
<p style='font-size: 14px; line-height: 190%;'><span style='font-size: 18px; line-height: 34.2px;'><strong><span style='line-height: 34.2px; font-size: 18px;'> Ciao $firstname , </span></strong></span></p>
@@ -65,20 +64,21 @@ if (isset($_GET['idbookingclass'])) {
$mail = new PHPMailer(true);
$mail->isSMTP(); // Set mailer to use SMTP
$mail->Host = 'mail.yogasoul.it'; // Specify main and backup server
$mail->SMTPAuth = true; // Enable SMTP authentication
$mail->Username = 'info@yogasoul.it'; // SMTP username
$mail->Password = '!Testolina88'; // SMTP password
$mail->SMTPSecure = 'tls'; // Enable encryption, 'ssl' also accepted
$mail->Port = '587';
$mail->isSMTP();
$mail->Host = $_ENV['MAIL_HOST'];
$mail->SMTPAuth = true;
$mail->Username = $_ENV['MAIL_USERNAME'];
$mail->Password = $_ENV['MAIL_PASSWORD'];
$mail->SMTPSecure = $_ENV['MAIL_ENCRYPTION']; // ssl
$mail->Port = (int) $_ENV['MAIL_PORT']; // 465
$mail->CharSet = 'UTF-8';
include('mail/emailtemplate2.php');
// Email body content
$htmlContent = $mailmessage1;
$mail->From = 'info@yogasoul.it';
$mail->FromName = 'YogiBook [YogaSoul]';
$mail->From = $_ENV['MAIL_FROM_ADDRESS'];
$mail->FromName = $_ENV['MAIL_FROM_NAME'];
$mail->addAddress($emailuser); // Add a recipient
$mail->Subject = "YogiBook - Lezione riprogrammata con successo!";
@@ -104,7 +104,3 @@ if (isset($_GET['idbookingclass'])) {
} else {
echo "Parametro 'idbookingclass' non trovato nella richiesta GET.";
}
// Chiudi la connessione al database
$conn->close();
?>