Skip to content

Repository files navigation

Swift-Sender (HumanMail)

Detect AI-generated emails and protect your inbox with intelligent filtering.

Overview

Swift-Sender (branded as HumanMail) is an email management tool that:

  • Integrates with Gmail to scan incoming emails
  • Detects AI-generated content using heuristic analysis
  • Auto-responds to or tags AI-detected emails
  • Provides a clean inbox view with AI likelihood scores

Quick Start

Prerequisites

  • Node.js 18+
  • npm or yarn

Installation

# Clone the repository
git clone https://github.com/antonhantel/swift-sender.git
cd swift-sender

# Install dependencies
npm install

# Copy environment variables
cp .env.example .env.local

# Start development server
npm run dev

Open http://localhost:3000 to see the app.

Demo Mode

By default, the app runs in DEMO_MODE which uses mock data instead of real Gmail integration. This is perfect for development and demos.

To enable demo mode, ensure your .env.local contains:

DEMO_MODE=true

Project Structure

swift-sender/
├── app/                    # Next.js App Router
│   ├── api/               # API Routes
│   │   ├── messages/      # GET /api/messages
│   │   ├── scan/          # POST /api/scan
│   │   ├── reply/         # POST /api/reply
│   │   └── draft/         # POST /api/draft
│   ├── auth/              # Authentication page
│   ├── dashboard/         # Main inbox view
│   ├── settings/          # User settings
│   ├── layout.tsx         # Root layout
│   ├── page.tsx           # Landing page
│   └── globals.css        # Global styles
├── components/            # React components
│   ├── dashboard/         # Dashboard components
│   ├── landing/           # Landing page components
│   ├── layout/            # Layout components (Navbar)
│   └── ui/                # shadcn/ui components
├── lib/                   # Implementation logic
│   ├── client.ts          # API client wrapper
│   ├── detect.ts          # AI detection heuristics
│   ├── gmail.ts           # Gmail API (TODO)
│   ├── reply.ts           # Reply generation
│   └── utils.ts           # Utility functions
├── shared/                # Shared types
│   └── contracts.ts       # API type contracts
├── demo/                  # Demo data
│   └── fixtures.json      # Mock email data
└── hooks/                 # React hooks

API Endpoints

GET /api/messages

Fetch messages from inbox.

Query Parameters:

  • limit (optional): Number of messages to fetch (default: 20)

Response:

{
  "messages": [
    {
      "id": "msg_001",
      "from": "John Smith",
      "fromEmail": "john@example.com",
      "subject": "Quick question",
      "date": "2026-01-18T10:30:00Z",
      "snippet": "Hey, do you have a moment...",
      "body": "Full email body..."
    }
  ]
}

POST /api/scan

Scan messages for AI-generated content.

Request Body:

{
  "messageIds": ["msg_001", "msg_002"]
}

Response:

{
  "results": [
    {
      "id": "msg_001",
      "aiScore": 87,
      "label": "Likely AI",
      "reasons": [
        "Contains 5 AI-typical phrases: \"unprecedented opportunity\", \"cutting-edge\"...",
        "Generic business outreach language detected"
      ]
    }
  ]
}

POST /api/reply

Generate a reply for an AI-detected email.

Request Body:

{
  "id": "msg_001",
  "tone": "neutral"  // "warm" | "neutral" | "firm"
}

Response:

{
  "replyText": "Hello,\n\nThank you for your email..."
}

POST /api/draft

Create a draft reply in Gmail.

Request Body:

{
  "id": "msg_001",
  "replyText": "Hello,\n\nThank you for your email..."
}

Response:

{
  "draftId": "draft_123456",
  "gmailUrl": "https://mail.google.com/mail/u/0/#drafts?compose=..."
}

AI Detection

The AI detection uses heuristic analysis to identify common patterns in AI-generated emails:

  • AI Phrases: Looks for buzzwords like "unprecedented opportunity", "cutting-edge", "paradigm-shifting"
  • Over-politeness: Excessive formal language and pleasantries
  • Generic Outreach: Template-like business language
  • Sentence Length: AI tends to write longer, more complex sentences
  • Subject Line Analysis: Verbose subject lines are often AI-generated

Scoring

  • 70-100%: Likely AI - Email flagged, action recommended
  • 40-69%: Maybe AI - Proceed with caution
  • 0-39%: Likely Human - Safe to process normally

Tech Stack

  • Framework: Next.js 14 (App Router)
  • Language: TypeScript
  • Styling: Tailwind CSS
  • UI Components: shadcn/ui
  • Icons: Lucide React
  • Theme: next-themes (dark/light mode)

Development

# Run development server
npm run dev

# Build for production
npm run build

# Start production server
npm start

# Run linting
npm run lint

Production Setup

For production use with real Gmail integration:

  1. Create a Google Cloud Project
  2. Enable Gmail API
  3. Configure OAuth consent screen
  4. Create OAuth 2.0 credentials
  5. Set environment variables:
    DEMO_MODE=false
    GOOGLE_CLIENT_ID=your_client_id
    GOOGLE_CLIENT_SECRET=your_client_secret
    
  6. Implement the TODO stubs in /lib/gmail.ts

License

MIT

About

intelligent Gmail inbox filter that detects AI-generated emails using heuristic analysis, assigns AI likelihood scores, and helps you automatically triage or respond to low-quality outreach - built with Next.js and TypeScript.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages