Detect AI-generated emails and protect your inbox with intelligent filtering.
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
- Node.js 18+
- npm or yarn
# 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 devOpen http://localhost:3000 to see the app.
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
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
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..."
}
]
}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"
]
}
]
}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..."
}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=..."
}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
- 70-100%: Likely AI - Email flagged, action recommended
- 40-69%: Maybe AI - Proceed with caution
- 0-39%: Likely Human - Safe to process normally
- Framework: Next.js 14 (App Router)
- Language: TypeScript
- Styling: Tailwind CSS
- UI Components: shadcn/ui
- Icons: Lucide React
- Theme: next-themes (dark/light mode)
# Run development server
npm run dev
# Build for production
npm run build
# Start production server
npm start
# Run linting
npm run lintFor production use with real Gmail integration:
- Create a Google Cloud Project
- Enable Gmail API
- Configure OAuth consent screen
- Create OAuth 2.0 credentials
- Set environment variables:
DEMO_MODE=false GOOGLE_CLIENT_ID=your_client_id GOOGLE_CLIENT_SECRET=your_client_secret - Implement the TODO stubs in
/lib/gmail.ts
MIT