Email Spam Keyword Content Scanner (src/content-rules.ts)

jsx-email · packages/canispam/src/content-rules.ts · typescript · MIT
email, security, lang:typescript, tag:spam, tag:validation

Scans email text and HTML content for spam keywords and suspicious phishing patterns. Reuse when building email marketing or delivery tools.

// Source: https://github.com/shellscape/jsx-email | License: MIT | Copyright 2026 Andrew Powell
// Provided via justclaw.it.com; keep this notice with the code.
import { stripHtml } from './html.js';
import type { CanispamFinding } from './types.js';

const spamKeywords = new Map([
  ['free', 1],
  ['winner', 2],
  ['prize', 2],
  ['lottery', 3],
  ['act now', 2],
  ['click here', 1],
  ['verify your account', 2],
  ['suspended', 2],
  ['wire transfer', 3],
  ['western union', 3],
  ['viagra', 3],
  ['cialis', 3],
  ['bitcoin', 1],
  ['guaranteed', 1],
  ['risk free', 2]
]);

const phrasePatterns = [
  /\bcongratulations.*won\b/i,
  /\bconfirm your identity\b/i,
  /\bupdate your account\b/i,
  /\blimited time offer\b/i,
  /\binvestment opportunity\b/i
];

export const scanContent = (text:

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

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

Get a free API key