The configuration of NoSpam Project is simple and fully managed via the config.yml file. This file contains the necessary settings for each email account you wish to monitor. Each account has its own section where you can specify IMAP credentials, OpenAI settings, prompts, and optional webhooks. This design ensures maximum flexibility, enabling tailored configurations per account.

With this approach, you can customize:

  • Email Account Settings: Specify server, credentials, and spam folder locations.
  • OpenAI Integration: Define unique API keys, models, and prompts for precise spam filtering.
  • Webhooks (Optional): Set up Slack or other notification systems for immediate alerts.
  • Flexible Intervals: Adjust how frequently each account is checked.

This modular configuration empowers you to monitor diverse accounts with varying priorities and requirements effectively. Whether you’re deploying on a personal NAS, in the cloud, or locally, config.yml simplifies the process.

config.yml

accounts:
  - name: "Personal Account"
    imap:
      server: "imap.example.com"
      port: 993
      username: "your_email@example.com"
      password: "your_password"
	  inbox_folder: "INBOX"
      spam_folder: "Spam"
      mark_as_seen: true
    openai:
      api_key: "your_openai_api_key"
      model: "gpt-4o-mini"
      prompt: |
        You are a careful and precise spam filter. Analyze the following message and decide if it should be flagged as spam or scam.
        Provide a decision in JSON: {"decision": {"scam": true/false}, "description": "<reason>"}.
    webhook:
      url: "https://your-webhook-url.com"
    checkinterval: 60

IMAP Settings

IMAP Settings, you can use every Email Provider that suppoerts IMAP. In som cases like google mail you have do allow imap connections or create a applications specific passowrt.

Webhook (Optional)

You can setup a slack webhook to get notified when a mail is sorted out.

Multiple Accounts (Optional)

You can configure multiple accounts in your config.yml file. Each account must have its own configuration, allowing you to customize settings such as servers, API keys, prompts, webhooks, and check intervals.

This flexibility is particularly useful if you need to monitor accounts with different levels of importance. For instance, critical accounts can be checked every minute or 30 seconds, while less important ones can have longer intervals. Additionally, you can assign tailored prompts to each account to refine spam detection based on specific needs (see prompt in the example below).

accounts:
  - name: "Personal Account A"
    imap:
      server: "imap.example.com"
      port: 993
      username: "your_email@example.com"
      password: "your_password"
	  inbox_folder: "INBOX"
      spam_folder: "Spam"
      mark_as_seen: true
    openai:
      api_key: "your_openai_api_key"
      model: "gpt-4o-mini"
      prompt: |
        You are a careful and precise spam filter. Analyze the following message and decide if it should be flagged as spam or scam.
        Provide a decision in JSON: {"decision": {"scam": true/false}, "description": "<reason>"}.
    webhook:
      url: "https://your-webhook-url.com"
    checkinterval: 60
 
  - name: "Personal Account B"
    imap:
      server: "imap.example.com"
      port: 993
      username: "your_email@example.com"
      password: "your_password"
	  inbox_folder: "INBOX"
      spam_folder: "Spam"
      mark_as_seen: true
    openai:
      api_key: "your_openai_api_key"
      model: "gpt-4o-mini"
      prompt: |
        You are a careful and precise spam filter. Analyze the following message and decide if it should be flagged as spam or scam.
        Provide a decision in JSON: {"decision": {"scam": true/false}, "description": "<reason>"}.
    webhook:
      url: "https://your-webhook-url.com"
    checkinterval: 120