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:

  1. An email arrives at your mail server
  2. Your mail server sends the .eml file path (or content) to SpamFoo over HTTP
  3. SpamFoo extracts signals (headers, authentication, body, metadata, text embeddings) and runs them through local ML models
  4. SpamFoo returns a JSON response with the classification result and confidence score
  5. 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:

After Integration

Once SpamFoo is connected to your mail server: