isEmailConfigured (utils/emailService.js)

BizzAI · backend/utils/emailService.js · javascript · Apache-2.0
email, tag:knn-classified

Utility module for configuring, verifying, and sending emails via Nodemailer, including templates.

// Source: https://github.com/orion-ai-community/BizzAI | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
// Provided via justclaw.it.com; keep this notice with the code.
import nodemailer from "nodemailer";

/**
 * Check if email is configured
 */
export const isEmailConfigured = () => {
  return global.EMAIL_ENABLED === true;
};

/**
 * Creates a reusable nodemailer transporter
 * Supports both Gmail and custom SMTP
 */
const createTransporter = () => {
  // Custom SMTP configuration (recommended for production)
  if (process.env.SMTP_HOST) {
    return nodemailer.createTransport({
      host: process.env.SMTP_HOST,
      port: parseInt(process.env.SMTP_PORT || "587", 10),
      secure: process.env.SMTP_SECURE === "true", // true for 465, false

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key