Skip to content

inbox451/inbox451

Repository files navigation

Inbox451 Logo

Inbox451

A simple email server that allows you to create inboxes and rules to filter emails, written in Go.

Go Report Card Build Status codecov License

Features

  • HTTP API for managing projects, inboxes, and rules
  • SMTP server for receiving emails
  • IMAP server for accessing emails
  • Rule-based email filtering
  • Configurable via YAML and environment variables

Quick Start

  1. Install dependencies:
make deps
  1. Start the development servers:
make dev          # Starts PostgreSQL and Go server
make run-frontend # In another terminal, starts Vite dev server

Visit http://localhost:8080 for the API and http://localhost:5173 for the development frontend.

Configuration

The application can be configured via:

  1. Environment variables (highest precedence)
  2. Configuration file
  3. Default values

Example configuration:

server:
  http:
    port: ":8080"
  smtp:
    domain: "smtp.example.com"
    hostname: "localhost"
    allow_insecure_auth: true
    msa:
      port: "587"
      tls: false
    mta:
      port: "1025"
      tls: false
  imap:
    port: ":1143"
    hostname: "localhost"
    tls: false
    allow_insecure_auth: true
  # Shared TLS certificate configuration for all services
  tls:
    cert_file: "/path/to/cert.pem"
    key_file: "/path/to/key.pem"
  email_domain: "example.com"
database:
  url: "postgres://inbox:inbox@localhost:5432/inbox451?sslmode=disable"
logging:
  level: "info"
  format: "json"

TLS Configuration

To enable TLS/STARTTLS for SMTP and IMAP servers:

  1. Generate or obtain SSL/TLS certificates
  2. Update the configuration with certificate paths in the server.tls section
  3. Enable TLS for specific services:
    • Set server.smtp.msa.tls: true for SMTP MSA (port 587)
    • Set server.smtp.mta.tls: true for SMTP MTA (port 25)
    • Set server.imap.tls: true for IMAP (port 1143)
  4. Set allow_insecure_auth: false to require encrypted connections for authentication

Example TLS-enabled configuration:

server:
  smtp:
    allow_insecure_auth: false
    msa:
      tls: true
  imap:
    tls: true
    allow_insecure_auth: false
  tls:
    cert_file: "/etc/ssl/certs/mail.example.com.crt"
    key_file: "/etc/ssl/private/mail.example.com.key"

API Examples

Create a Project:

curl -X POST http://localhost:8080/api/projects \
  -H "Content-Type: application/json" \
  -d '{"name": "Test Project"}'

Create an Inbox:

curl -X POST http://localhost:8080/api/projects/1/inboxes \
  -H "Content-Type: application/json" \
  -d '{"email": "[email protected]"}'

Create a Rule:

curl -X POST http://localhost:8080/api/projects/1/inboxes/1/rules \
  -H "Content-Type: application/json" \
  -d '{
    "sender": "[email protected]",
    "receiver": "[email protected]",
    "subject": "Test Subject"
  }'

Testing Email Reception

Using SWAKS:

swaks --to [email protected] \
      --from [email protected] \
      --server localhost:1025 \
      --header "Subject: Test Subject" \
      --body "This is a test email."

Project Structure

.
├── cmd/                # Application entry points
├── frontend/           # Vue.js frontend application
├── internal/           # Internal packages
│   ├── api/            # HTTP API implementation
│   ├── core/           # Business logic
│   ├── smtp/           # SMTP server
│   ├── imap/           # IMAP server
│   ├── migrations/     # Database migrations
│   ├── storage/        # Database repositories
│   └── models/         # Database models
└── bruno/              # API test collections

Documentation

License

MIT

About

A simple email server that allows you to create inboxes and rules to filter emails, written in Go.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •