Overview
Discover what makes Sendmail powerful
Sendmail is a mature, open‑source Mail Transfer Agent (MTA) that has powered email delivery for decades. From a developer’s standpoint, it is a highly configurable daemon written primarily in C that implements the SMTP protocol and related mail handling standards (RFC 5321, RFC 5322, etc.). The core of Sendmail is the `sendmail` binary, which parses incoming and outgoing mail headers, applies routing rules, performs anti‑spam checks, and hands messages to local delivery agents or remote SMTP servers. The configuration is expressed through a domain‑specific language (the `sendmail.cf` file), which can be generated from human‑readable macros in `m4`. This approach gives developers granular control over every aspect of mail flow, from aliasing and virtual domains to sophisticated policy checks.
Language & Runtime
Configuration
Databases
Modules & Hooks
Overview
Sendmail is a mature, open‑source Mail Transfer Agent (MTA) that has powered email delivery for decades. From a developer’s standpoint, it is a highly configurable daemon written primarily in C that implements the SMTP protocol and related mail handling standards (RFC 5321, RFC 5322, etc.). The core of Sendmail is the sendmail binary, which parses incoming and outgoing mail headers, applies routing rules, performs anti‑spam checks, and hands messages to local delivery agents or remote SMTP servers. The configuration is expressed through a domain‑specific language (the sendmail.cf file), which can be generated from human‑readable macros in m4. This approach gives developers granular control over every aspect of mail flow, from aliasing and virtual domains to sophisticated policy checks.
Architecture
- Language & Runtime: C (≈ 300 k lines), compiled with GCC or Clang, runs as a single long‑lived process.
- Configuration:
sendmail.cf(compiled fromm4macros). The macro system allows embedding logic, regular expressions, and conditional statements. - Databases: Supports multiple back‑ends for mail routing—
hash,dbm,gdbm, andSQLvia thesmtpd_relaymodule. For large deployments, administrators often integrate PostgreSQL or MySQL for alias tables and policy checks. - Modules & Hooks: Loadable modules (
sendmail.c,smtpd_relay,check_rcpt, etc.) enable extensibility. Thesendmailbinary can be extended with custom C modules compiled against the Sendmail API. - Logging & Monitoring: Syslog integration,
maillog, and optional external log shippers (e.g., Fluentd) for observability.
Core Capabilities
- SMTP & SMTP‑TLS: Full compliance with modern TLS extensions (STARTTLS, SNI) and support for modern cipher suites.
- Policy Checks:
check_policy_serviceallows external services (e.g., spam filters, DKIM validators) to influence routing decisions. - Virtual Domains & Mailboxes: Native support for virtual domains, per‑user maildir or mbox storage, and mailbox forwarding.
- Transport Maps: Flexible transport maps (
/etc/mail/sendmail.mc→sendmail.cf) enable per‑recipient routing, load balancing, and failover. - Milter Interface: The Mail Filter (milter) API lets developers write C or higher‑level language extensions that inspect and modify mail in transit.
- SMTP Authentication: Supports SASL mechanisms (PLAIN, LOGIN, CRAM‑MD5) via the
smtpddaemon.
Deployment & Infrastructure
Sendmail can be deployed on any POSIX‑compatible host (Linux, BSD, macOS). For modern cloud environments, it is commonly containerized using Docker or Kubernetes:
- Containerization: A minimal base image (Alpine, Debian Slim) with the Sendmail binary and a pre‑generated
sendmail.cf. Configuration files can be mounted as ConfigMaps or Secrets. - Scalability: Horizontal scaling is achieved by running multiple instances behind a load balancer (e.g., HAProxy) with shared routing tables or by using
sendmail’s built‑inrelaymode for clustering. - High Availability: Replicated databases (PostgreSQL, MySQL) and shared mail storage (NFS, Ceph) ensure redundancy. The
sendmailprocess itself is stateless after initialization, simplifying failover.
Integration & Extensibility
- Milter Plugins: Developers can write milter plugins in C, Python (via
pymilter), or Go (gomilter). These plug‑ins can perform spam scoring, DKIM signing, content filtering, or custom routing logic. - External Policy Services:
check_policy_servicecan call any HTTP/SMTP service. This is commonly used to integrate with third‑party reputation services or internal corporate policies. - Webhooks & APIs: While Sendmail itself does not expose a REST API, many organizations wrap it with lightweight HTTP services that query the mail queue or trigger re‑routing. The
sendmailcommand line (-q,-d) can be invoked from scripts. - Custom Modules: The Sendmail API allows linking custom C modules (
.sofiles) that can hook into the message processing pipeline, providing deep integration points.
Developer Experience
- Documentation: The official Sendmail documentation is extensive but dense. Key resources include the
sendmail.mcmacro manual, RFC references, and community‑maintained guides (e.g., on the Sendmail project wiki). - Community & Support: An active mailing list (
sendmail-users@lists.sourceforge.net) and a dedicated CERT advisory channel provide timely security updates. Commercial support is available from vendors that maintain Sendmail distributions. - Configuration Complexity: The macro system can be daunting; however, once the
sendmail.mctemplates are mastered, generating a cleansendmail.cfis straightforward. Tools likem4andmakeautomate this process. - Testing: Unit testing of configuration changes is typically performed with
sendmail -bt(testing the mailbox lookup) and custom test harnesses that send SMTP sessions to a
Open SourceReady to get started?
Join the community and start self-hosting Sendmail 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
OpenSlides
Digital assembly platform for agendas, motions and elections
Hyrax
Digital repository framework built on Ruby on Rails
Miaou
Self‑hosted multi‑room chat with rich features
Reactive Resume
Build and share resumes in seconds, privately
Flipt
Git-native feature flags for safe, instant deployments
Zulip
Topic‑based team chat for live and async collaboration

