| Server IP : 3.111.61.48 / Your IP : 216.73.216.67 Web Server : Apache System : Linux ip-10-0-5-176 6.8.0-1057-aws #60~22.04.1-Ubuntu SMP Wed May 27 08:16:59 UTC 2026 x86_64 User : ubuntu ( 1000) PHP Version : 8.2.31 Disable Function : exec,passthru,shell_exec,system MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /var/www/vhost/book.gyaniguru.org/includes/ |
Upload File : |
<?php
require_once __DIR__ . '/../vendor/autoload.php';
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
define('SMTP_HOST', 'smtp.gmail.com');
define('SMTP_PORT', 587);
define('SMTP_USER', 'your-email@gmail.com');
define('SMTP_PASS', 'your-app-password');
define('MAIL_FROM', 'your-email@gmail.com');
define('MAIL_FROM_NAME', 'GyaniGuru by JMC');
function sendMail($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;
$mail->Port = SMTP_PORT;
$mail->CharSet = 'UTF-8';
$mail->setFrom(MAIL_FROM, MAIL_FROM_NAME);
$mail->addAddress($to);
$mail->isHTML(true);
$mail->Subject = $subject;
$mail->Body = $body;
$mail->send();
return true;
} catch (Exception $e) {
error_log("Mail Error: " . $mail->ErrorInfo);
return false;
}
}
function sendOtpEmail($to, $name, $otp) {
$subject = 'Your OTP for Password Reset — GyaniGuru by JMC';
$body = '
<div style="font-family: \'Segoe UI\', Arial, sans-serif; max-width: 520px; margin: 0 auto; background: #f8f7f4; border-radius: 16px; overflow: hidden; border: 1px solid #e0ddd8;">
<div style="background: linear-gradient(135deg, #3D1A00 0%, #6B3010 100%); padding: 30px 24px; text-align: center;">
<div style="font-size: 2.5rem; margin-bottom: 4px;">🔱</div>
<h1 style="color: #D4AF37; margin: 0; font-size: 1.3rem; letter-spacing: 1px;">GYANIGURU by JMC</h1>
<p style="color: rgba(255,255,255,0.7); margin: 4px 0 0; font-size: .8rem;">AUTHENTIC VEDIC WISDOM</p>
</div>
<div style="padding: 32px 24px; background: #fff;">
<p style="color: #3D1A00; font-size: 1rem; margin: 0 0 4px;">Namaste <strong>' . htmlspecialchars($name) . '</strong>,</p>
<p style="color: #6B7280; font-size: .9rem; margin-bottom: 20px;">Use the OTP below to reset your password. It expires in 10 minutes.</p>
<div style="background: #fffbeb; border: 1px solid rgba(212,175,55,.3); border-radius: 12px; padding: 20px; text-align: center; margin-bottom: 20px;">
<div style="font-size: .75rem; color: #9CA3AF; text-transform: uppercase; letter-spacing: 2px; margin-bottom: 8px;">One-Time Password</div>
<div style="font-size: 2rem; font-weight: 800; letter-spacing: 8px; color: #3D1A00; font-family: monospace;">' . $otp . '</div>
</div>
<p style="color: #9CA3AF; font-size: .78rem; margin: 0;">If you didn\'t request this, please ignore this email.</p>
</div>
<div style="background: #f3f1ed; padding: 16px 24px; text-align: center;">
<p style="color: #9CA3AF; font-size: .72rem; margin: 0;">© ' . date('Y') . ' GyaniGuru by JMC. All rights reserved.</p>
</div>
</div>';
return sendMail($to, $subject, $body);
}