myth / postal
A modern CodeIgniter 4 email replacement library.
Fund package maintenance!
Requires
- php: ^8.2
- league/commonmark: ^2.4
- tijsverkoyen/css-to-inline-styles: ^2.2
Requires (Dev)
- aws/aws-sdk-php: ^3.0
- codeigniter/phpstan-codeigniter: ^1.3
- codeigniter4/devkit: ^1.3
- codeigniter4/framework: ^4.7
- mockery/mockery: ^1.0
- phpstan/phpstan-strict-rules: ^2.0
- roave/security-advisories: dev-latest
Suggests
- ext-curl: to use the API transports (e.g. ResendTransport) with the default CurlHttpClient
- aws/aws-sdk-php: ^3.0 to use the Amazon SES (SesTransport) delivery transport
- psr/http-client: ^1.0 to send API transport requests through your own PSR-18 client (Psr18HttpClient)
- psr/http-factory: ^1.0 for the PSR-17 request and stream factories Psr18HttpClient needs
Provides
None
Conflicts
- phpstan/phpstan: 2.3.4
Replaces
None
This package is auto-updated.
Last update: 2026-10-31 21:18:24 UTC
README
A modern email library for CodeIgniter 4.
Write a message once and send it through SMTP, Amazon SES, Resend, sendmail or a failover chain.
You choose the provider in config, not code. Mailables, Markdown emails, DKIM signing,
suppression lists and test fakes are built in, and existing service('email') calls keep
working, so you can adopt Postal one step at a time.
Status: stable. Postal follows semantic versioning: breaking changes only arrive in a new major version and are called out in the changelog.
📖 Documentation
- Quick Start: configure a mailer and send your first email
- Migrating from CI4's Email: move an existing app over in stages
Installation
Requires PHP 8.2+ and CodeIgniter 4.7+.
composer require myth/postal
Quick look
<?php use Myth\Postal\Email; $email = (new Email()) ->from('hello@example.com', 'Acme') ->to('user@example.com') ->subject('Welcome aboard') ->html('<p>Glad to have you with us.</p>'); $result = service('mailer')->send($email); if (! $result->success) { log_message('error', 'Welcome email failed: ' . $result->error); }
Out of the box the default mailer discards every message, so nothing is sent by accident. The Quick Start sets up a real one.
Contributing
Contributions are welcome. Run composer ci (style, static analysis and tests) before opening a
pull request, and cover new behavior with tests. Every Composer script has a Docker equivalent
prefixed with docker:, such as composer docker:ci.
Support Postal
Postal is free and open source, built and maintained by Lonnie Ezell. If it saves you time, please consider sponsoring its development on GitHub. Sponsorship helps fund new features, fixes and the documentation.
License
Released under the MIT License.