getVerificationEmailTemplate($verificationUrl); return $this->sendEmail($email, $subject, $htmlBody); } public function sendPasswordResetEmail($email, $token) { $resetUrl = SITE_URL . "/reset-password.php?token=" . $token; $subject = "Reset Your Password - " . SITE_NAME; $htmlBody = $this->getPasswordResetEmailTemplate($resetUrl); return $this->sendEmail($email, $subject, $htmlBody); } private function sendEmail($to, $subject, $htmlBody) { // For basic PHP mail() function (works on most shared hosting) $headers = "MIME-Version: 1.0" . "\r\n"; $headers .= "Content-type:text/html;charset=UTF-8" . "\r\n"; $headers .= "From: " . FROM_NAME . " <" . FROM_EMAIL . ">" . "\r\n"; $headers .= "Reply-To: " . FROM_EMAIL . "\r\n"; $headers .= "X-Mailer: PHP/" . phpversion(); try { $result = mail($to, $subject, $htmlBody, $headers); if ($result) { logError("Email sent successfully to: " . $to); return true; } else { logError("Failed to send email to: " . $to); return false; } } catch (Exception $e) { logError("Email sending exception: " . $e->getMessage(), ['email' => $to]); return false; } } private function getVerificationEmailTemplate($verificationUrl) { return ' Email Verification

' . SITE_NAME . '

Welcome to India\'s Trusted Survey Platform

Welcome! Please Verify Your Email

Thank you for registering with ' . SITE_NAME . '! We\'re excited to have you join our community of survey takers across India.

To complete your registration and start earning money through paid surveys, please verify your email address by clicking the button below:

Verify My Email Address

Important: This verification link will expire in 24 hours. If you don\'t verify your email within this time, you\'ll need to register again.

If the button above doesn\'t work, you can also copy and paste this link into your browser:

' . $verificationUrl . '

Once your email is verified, you can:

If you didn\'t create an account with us, please ignore this email.

Best regards,
The ' . SITE_NAME . ' Team

'; } private function getPasswordResetEmailTemplate($resetUrl) { return ' Reset Your Password

' . SITE_NAME . '

Password Reset Request

Reset Your Password

We received a request to reset your password for your ' . SITE_NAME . ' account.

If you made this request, click the button below to reset your password:

Reset My Password

Security Notice: This password reset link will expire in 2 hours for your security. If you don\'t reset your password within this time, you\'ll need to request a new reset link.

If the button above doesn\'t work, you can also copy and paste this link into your browser:

' . $resetUrl . '

If you didn\'t request a password reset:

Best regards,
The ' . SITE_NAME . ' Team

'; } } ?>