Download the PHP package jardisadapter/mailer without Composer
On this page you can find all versions of the php package jardisadapter/mailer. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download jardisadapter/mailer
More information about jardisadapter/mailer
Files in jardisadapter/mailer
Package mailer
Short Description SMTP mail client with STARTTLS, authentication, HTML and plain text support, attachments, and retry with exponential backoff; a building block of the open-source foundation that Jardis-generated DDD code runs on
License MIT
Homepage https://jardis.io
Informations about the package mailer
Jardis Mailer
Part of Jardis — the Domain-Driven Design platform for PHP. You model your domain; Jardis generates the production-ready hexagonal code (DTOs, Command/Query handlers, repositories, persistence). This package is part of the open-source foundation that generated code runs on.
Transactional emails without the bloat. A lean SMTP mailer for PHP built on raw sockets — covers order confirmations, password resets, and notifications. No Swiftmailer, no Symfony Mailer, no dependency tree. Just SMTP over a socket.
* Zero external PHP packages. Only ext-openssl + ext-mbstring + jardissupport/contracts (interfaces only).
Why This Mailer?
- Two classes are enough —
Mailer+SmtpConfig, nothing else to learn - Fluent message builder — immutable,
with*pattern like PSR-7 - STARTTLS + implicit SSL — secure by default, PORT 587 or 465
- AUTH LOGIN & PLAIN — standard SMTP authentication
- HTML + plain text — multipart/alternative, just works
- File attachments & inline images — Base64 encoded, Content-ID for HTML embedding
- Retry with backoff — automatic retry on connection errors and temporary SMTP failures
- Connection keepalive — send 100 emails over one SMTP connection
- NOOP health-check — stale connections are silently reconnected
- 96% test coverage — integration tests against a real SMTP server, not mocks
Installation
Quick Start
Send a Simple Email
HTML + Plain Text
Both bodies are sent as multipart/alternative — the recipient's mail client picks the best one.
Attachments
Inline Images in HTML
Multiple Recipients, CC, BCC
Custom Headers
Fully Configured
Batch Sending
Send multiple emails over a single SMTP connection — the connection stays alive between messages:
Retry
Automatically retries on SmtpConnectionException and temporary SMTP errors (4xx). No retry on permanent errors (5xx) — those are recipient or policy errors.
Error Handling
| Exception | When |
|---|---|
SmtpConnectionException |
Host unreachable, TLS handshake failure, timeout |
SmtpAuthenticationException |
LOGIN or PLAIN rejected |
SmtpTransportException |
SMTP protocol error (rejected recipient, DATA error) |
MailMessageException |
Invalid message (missing From, To, or body) |
All implement MailerExceptionInterface for generic catch:
Encryption
| Port | Encryption | How it works |
|---|---|---|
| 587 | tls (default) |
Connects plain, upgrades via STARTTLS |
| 465 | ssl |
Connects over implicit TLS |
| 25 | none |
No encryption (not recommended) |
Architecture
The user only sees Mailer + SmtpConfig + MailMessage. Internally, the mailer orchestrates a pipeline of invokable handlers — built from the config:
Each handler is an invokable object (__invoke) — independently testable, replaceable, composable. Only what is configured gets instantiated.
Custom Transport
The transport is a closure — replaceable for testing or alternative delivery:
Jardis Foundation Integration
In a Jardis DDD project, the mailer is automatically configured via ENV:
The MailerHandler in JardisApp builds the mailer and registers it in the ServiceRegistry. Your application code receives MailerInterface via injection — without ever importing Mailer directly.
Development
Documentation
Full documentation, guides, and API reference:
docs.jardis.io/en/adapter/mailer
License
MIT License — free for any use, including commercial.
AI-Assisted Development
This package ships with a skill for Claude Code, Cursor, Continue, and Aider. Install it in your consuming project:
More details: https://docs.jardis.io/en/skills
All versions of mailer with dependencies
ext-openssl Version *
ext-mbstring Version *
jardissupport/contracts Version ^1.0 || ^2.0