D:\host\scoreman.in\tldt2025\sendmail2.php
<?php
require 'PHPMailer/PHPMailer.php';
require 'PHPMailer/SMTP.php';
require 'PHPMailer/Exception.php';
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
//require 'vendor/autoload.php'; // path to PHPMailer's autoload.php
include('dbconnect.php');
include('functions.php');
ini_set('max_execution_time', 0);
$appno = $_GET["app"];
//sendform($appno); // if this already handles sending, the rest below won’t run. Consider removing this call if PHPMailer should handle all.
//exit();
$databaseQuery = 'SELECT appno, sname, email, hashcode FROM applications WHERE appno = "'.$appno.'"';
$result = mysqli_query($con, $databaseQuery) or die('Query failed: ' . mysqli_error($con));
if ($result) {
$row = mysqli_fetch_array($result);
$appno = $row["appno"];
$sname = $row["sname"];
$email = $row["email"];
$key = $row["hashcode"];
$content = '<html><body><b>Dear Skater '.$sname.',<br/><br/></b><br/>
Your registration is complete.<br/><br/>
You can download your <b>DISTRICT ROLLER SKATING CHAMPIONSHIP 2025 - Entry Form </b> in the following link.<br/>
<a href="https://telanganaskate.com/districts2025/application.php?appno='.$appno.'&k='.$key.'">Click Here to Print / Download Application Form</a>
<br/><br/>
Please contact your District Unit for further details and approval.<br/><br/>
Thanks & Regards<br/>
TRSA<br/>
telanganaskate.com
</body></html>';
$mail = new PHPMailer(true);
try {
//Server settings
$mail->isSMTP();
$mail->Host = 'cloud4a.fastwebhost.in'; // e.g., smtp.gmail.com or your mail server
$mail->SMTPAuth = true;
$mail->Username = 'noreply@telanganaskate.com'; // your email
$mail->Password = 'priority1@1'; // your email password
$mail->SMTPSecure = ''; // or 'ssl'
$mail->Port = 25; // 465 for SSL
$mail->SMTPDebug = 2; // or 3 for more info
$mail->Debugoutput = 'html';
//Recipients
$mail->setFrom('noreply@telanganaskate.com', 'TRSA');
$mail->addAddress($email, $sname);
$mail->addBCC('jeganonly@gmail.com');
// Content
$mail->isHTML(true);
$mail->Subject = $sname." | Entry Form ".$appno." | TELANGANA-DISTRICTS-2025";
$mail->Body = $content;
$mail->send();
$mailres = "Success";
} catch (Exception $e) {
$mailres = "Mailer Error: " . $mail->ErrorInfo;
}
// Update status
$qtext = 'UPDATE applications SET emailstatus="'.mysqli_real_escape_string($con, $mailres).'" WHERE appno = "'.$appno.'"';
mysqli_query($con, $qtext);
echo "<tr><td>".$appno."</td><td>".$sname."</td><td>".$email."</td><td>".$mailres."</td></tr>";
}
echo "finished Success";
?>