Overview
Discover what makes E-MailRelay powerful
E‑MailRelay is a **lightweight, store‑and‑forward SMTP server** designed for self‑hosted environments. It accepts inbound mail via the standard **SMTP port 25** (with optional TLS) and stores messages in a local `maildir` format. The daemon can then forward the queued mail to a configured **smarthost** or perform DNS‑MX routing on a per‑recipient basis. The same binary also exposes a **POP3 interface** for clients to retrieve the stored mail, making it suitable both as an outbound relay and a minimal personal mailbox.
Language
Core libraries
Data storage
Extensibility
Overview
E‑MailRelay is a lightweight, store‑and‑forward SMTP server designed for self‑hosted environments. It accepts inbound mail via the standard SMTP port 25 (with optional TLS) and stores messages in a local maildir format. The daemon can then forward the queued mail to a configured smarthost or perform DNS‑MX routing on a per‑recipient basis. The same binary also exposes a POP3 interface for clients to retrieve the stored mail, making it suitable both as an outbound relay and a minimal personal mailbox.
Technical Stack & Architecture
- Language: C, yielding high performance and low memory footprint.
- Core libraries: OpenSSL for TLS support,
libpamfor authentication, and POSIX sockets for network I/O. - Data storage:
maildirdirectories on the local filesystem; no external database is required. - Extensibility: A plug‑in‑style filter system where each mail message passes through a configurable chain of filters (e.g.,
spam,copy,deliver). Filters are invoked via simple command scripts or compiled shared objects, allowing developers to insert custom logic without modifying the core. - Process model: Single‑process with optional child workers for handling concurrent SMTP/POP connections. The daemon can be launched via
systemdsocket activation or as a standalone service, supporting Unix domain sockets and SOCKS proxies for flexible deployment.
Core Capabilities & APIs
- SMTP/POP3 servers with full RFC‑5321 and RFC‑1939 compliance, including STARTTLS, authentication (PAM or custom), and submission extensions.
- Filtering pipeline: Built‑in filters (
spam,copy,deliver,split) and the ability to add custom ones. Filters receive environment variables describing the message (e.g.,RCPT_TO,MAIL_FROM) and can modify headers or content before forwarding. - Address verification: Optional external address verifier servers (e.g., SMTP RCPT‑TO checks) and built‑in DNSBL lookups for blocking unwanted senders.
- Rate limiting & retry logic: Configurable per‑recipient or global limits, with exponential back‑off for failed deliveries.
- Delivery status notifications (DSN): Generates bounce messages on failure, integrating with the
maildirstore. - Web‑based administration interface: Exposes real‑time statistics, queue inspection, and configuration editing over HTTPS, protected by the same authentication mechanisms as SMTP/POP.
Deployment & Infrastructure
E‑MailRelay is container‑ready; a minimal Docker image can expose ports 25, 110, and the admin interface. It requires only a writable directory for maildir storage and an outbound network connection to the smarthost. Because it runs in a single process, horizontal scaling is achieved by deploying multiple instances behind an external load balancer or using a reverse‑proxy that supports SMTP connection pooling. The daemon’s small footprint (≈ 10 MB binary) and reliance on standard libraries make it ideal for edge devices, VPS hosts, or Kubernetes pods.
Integration & Extensibility
- Plugin system: Developers can write custom filters in any language that reads from
stdinand writes tostdout, or compile them as shared objects loaded at runtime. - Webhooks: The admin interface can trigger external HTTP callbacks on queue events (e.g., delivery success/failure).
- API: A REST‑like JSON API is available for programmatic queue inspection and mail injection, useful for integrating with CI/CD pipelines or microservices that need to send transactional emails.
- Configuration DSL: A declarative configuration file (
relay.conf) supports nested sections, variable interpolation, and includes, allowing complex routing rules without code changes.
Developer Experience
The documentation is concise yet thorough, covering command‑line options, configuration syntax, and filter development. Inline comments in the config file serve as a living reference. The project’s community is active on GitHub, with issue trackers for bug reports and pull requests for new filters. Licensing under the GPLv3 ensures that any derivative work remains open source, encouraging contributions and fostering a shared ecosystem of plugins.
Use Cases
- Personal mail server: A developer can run E‑MailRelay on a home router or NAS to receive and forward mail with SpamAssassin filtering.
- Transactional email gateway: Applications that generate emails (e.g., account verification) can inject messages into the
maildir, letting E‑MailRelay handle queuing, retries, and delivery to an SMTP provider. - Email archiving: By configuring the
copyfilter to duplicate messages into a separate directory, developers can create an immutable audit trail for compliance. - SMTP relay in CI pipelines: Continuous‑integration services can use E‑MailRelay as a lightweight SMTP server to test email delivery without exposing the actual provider.
Advantages Over Alternatives
- Performance: The C implementation processes thousands of messages per second with minimal CPU usage, outperforming many interpreted MTAs.
- Simplicity: No database or complex service mesh is required; a single binary plus a
maildirdirectory suffices. - Extensibility: The filter chain lets developers inject custom logic without patching the core, unlike monolithic MTAs.
- Security: Built‑in DNSBL blocking and optional PAM authentication reduce exposure to spam and unauthorized
Open SourceReady to get started?
Join the community and start self-hosting E-MailRelay today
Related Apps in apis-services
Mastodon
Decentralized, real‑time social networking
Discourse
Open‑source community forum platform with real‑time chat and AI
Rocket.Chat
Secure, open‑source team communication platform
Novu
Unified notification platform for multi‑channel delivery
Mattermost
Secure, self‑hosted team collaboration with chat, voice, and AI
Jitsi Meet
Free, encrypted video conferencing for everyone
Weekly Views
Repository Health
Information
Explore More Apps
Lowdefy
Build web apps with config, not code
Typemill
Hybrid CMS for user manuals, docs, and eBooks
RERO ILS
Modern open‑source library management for heritage, public and school libraries
Operational
Real‑time event monitoring and alerting for startups
WebThings Gateway
Self‑hosted smart home hub for privacy and control
Lidarr
Automated music collection manager for torrent and Usenet users