Mail Server Integration
SpamFoo runs on your mail server and classifies email locally. This section covers how to connect SpamFoo to your mail server or workflow.
How Integration Works
SpamFoo runs as a local HTTP service on port 16253. Your mail server sends email data to SpamFoo for
classification, and SpamFoo returns a result (spam or not spam, plus a class like Primary, Promotions, Updates, or
Transactions). The entire process happens locally with no external network calls during classification.
The typical flow:
- An email arrives at your mail server
- Your mail server sends the
.emlfile path (or content) to SpamFoo over HTTP - SpamFoo extracts signals (headers, authentication, body, metadata, text embeddings) and runs them through local ML models
- SpamFoo returns a JSON response with the classification result and confidence score
- Your mail server routes, tags, or quarantines the email based on the result
SpamFoo queues requests when the server is under load and returns a 503 if the queue is full, so your mail server can fall back to delivering the email unclassified. See Performance Tuning for queue configuration.
Choosing an Integration Method
All integrations connect to SpamFoo through the local API (HTTP). Mail servers call it directly, and scripts can call it from the command line with tools like curl. A watched folder method is in development and not yet available.
| Method | Protocol | Best For |
|---|---|---|
| Local API | HTTP (port 16253) | Production mail servers, real-time classification |
| Command Line | HTTP via curl or similar tools |
Scripting, testing, batch processing |
Mail Server Guides
Select your mail server for step-by-step integration instructions:
Custom Integration
If your mail server is not listed above, or you need to integrate SpamFoo into a custom workflow, use one of these methods directly:
Local API
Send HTTP requests to the local REST API for real-time classification and feedback.
Command Line
Start the service and classify email from the command line with tools like curl.
Watched Folder (in development)
Drop .eml files into a monitored directory for automatic classification. Not yet available.
After Integration
Once SpamFoo is connected to your mail server:
- Open the admin dashboard at
http://localhost:16253/adminto verify emails are being classified - Set up feedback and training so user corrections improve classification over time
- Configure health monitoring to detect service issues early
- Review best practices for production deployment