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; // Recipients $mail->setFrom(NOTIFICATION_EMAIL, 'Breach Monitor'); $mail->addAddress($email); // Content $mail->isHTML(true); $mail->Subject = 'Security Alert: Email Compromise Detected'; $mail->Body = $this->generateEmailTemplate($breachDetails); $mail->send(); return true; } catch (Exception $e) { error_log("Notification failed: {$mail->ErrorInfo}"); return false; } } private function generateEmailTemplate($breachDetails) { return "
Your email was found in a data breach:
Please take immediate action to secure your account, including changing your password and enabling two-factor authentication.
"; } }