PHPackages                             tatter/outbox - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Logging &amp; Monitoring](/categories/logging)
4. /
5. tatter/outbox

ActiveLibrary[Logging &amp; Monitoring](/categories/logging)

tatter/outbox
=============

Email toolkit for CodeIgniter 4

v2.1.1(3y ago)168.6k↓68.2%5[4 issues](https://github.com/tattersoftware/codeigniter4-outbox/issues)[3 PRs](https://github.com/tattersoftware/codeigniter4-outbox/pulls)1MITPHPPHP ^7.4 || ^8.0

Since Jun 23Pushed 1y ago3 watchersCompare

[ Source](https://github.com/tattersoftware/codeigniter4-outbox)[ Packagist](https://packagist.org/packages/tatter/outbox)[ Docs](https://github.com/tattersoftware/codeigniter4-outbox)[ Fund](https://paypal.me/tatter)[ GitHub Sponsors](https://github.com/tattersoftware)[ RSS](/packages/tatter-outbox/feed)WikiDiscussions develop Synced 3w ago

READMEChangelog (10)Dependencies (4)Versions (18)Used By (1)

Tatter\\Outbox
==============

[](#tatteroutbox)

Email toolkit for CodeIgniter 4

[![](https://github.com/tattersoftware/codeigniter4-outbox/workflows/PHPUnit/badge.svg)](https://github.com/tattersoftware/codeigniter4-outbox/actions/workflows/phpunit.yml)[![](https://github.com/tattersoftware/codeigniter4-outbox/workflows/PHPStan/badge.svg)](https://github.com/tattersoftware/codeigniter4-outbox/actions/workflows/phpstan.yml)[![](https://github.com/tattersoftware/codeigniter4-outbox/workflows/Deptrac/badge.svg)](https://github.com/tattersoftware/codeigniter4-outbox/actions/workflows/deptrac.yml)[![Coverage Status](https://camo.githubusercontent.com/8c0fcbfb892d054c6e3a46cc7c0b8c77315b49bfa1c91ed64d01a2e8b29ae162/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f746174746572736f6674776172652f636f646569676e69746572342d6f7574626f782f62616467652e7376673f6272616e63683d646576656c6f70)](https://coveralls.io/github/tattersoftware/codeigniter4-outbox?branch=develop)

Quick Start
-----------

[](#quick-start)

1. Install with Composer: `> composer require tatter/outbox`
2. Prepare the database: `> php spark migrate -all && php spark db:seed "Tatter\Outbox\Database\Seeds\TemplateSeeder"`
3. Send beautiful, dynamic email:

```
model(TemplateModel::class)->findByName('Default')
	->email([
		'item' => 'Fancy Purse',
		'cost' => '10 dollars',
		'url'  => site_url('items/show/' . $itemId),
	])
	->setTo($user->email)
	->send();
```

Features
--------

[](#features)

**Outbox** supplies useful tools to supplement the framework's native `Email` class: logging, style inlining, and templating.

Installation
------------

[](#installation)

Install easily via Composer to take advantage of CodeIgniter 4's autoloading capabilities and always be up-to-date:

```
composer require tatter/outbox
```

Or, install manually by downloading the source files and adding the directory to **app/Config/Autoload.php**.

Configuration (optional)
------------------------

[](#configuration-optional)

The library's default behavior can be altered by extending its config file. Copy **examples/Outbox.php** to **app/Config/** and follow the instructions in the comments. If no config file is found in **app/Config** then the library will use its own.

If you plan to use the Template Routes (see below) you might also want to configure [Tatter\\Layouts](https://github.com/tattersoftware/codeigniter4-layouts) to ensure the views are displayed properly for your app.

Usage
-----

[](#usage)

### Logging

[](#logging)

By default **Outbox** will log any successfully sent emails in the database. This provides a handy paper-trail for applications that send a variety of status and communication messages to users. Use the `Tatter\Outbox\Models\EmailModel` and its corresponding entity to view email logs.

### Inlining

[](#inlining)

Sending HTML email can be tricky, as support for HTML and CSS vary across displays and devices. **Outbox** includes `CssToInlineStyles`, a module by *tijsverkoyen* to take any CSS and inject it inline into an email template for maximum compatibility. This allows you to reuse site stylesheets or write your own from scratch and use them across any of your templates. Use the default styles from [Responsive HTML Email Template](https://github.com/leemunroe/responsive-html-email-template), supply your own as string parameters, or create a View file and add it to the configuration.

Templating
----------

[](#templating)

**Outbox** comes with a default template, a modified-for-CodeIgniter version of the [Responsive HTML Email Template](https://github.com/leemunroe/responsive-html-email-template). This provides a solid basis for your emails so you can be sure they will display nicely on any device. Run the Template Seeder to begin using this as the default:

```
	php spark db:seed "Tatter\Outbox\Database\Seeds\TemplateSeeder"
```

You may also write your own templates and seed them or use the provided MVC bundle for managing email templates in your database. To enable the Controller you will need to toggle `$routeTemplates` in the configuration, or add the following routes to **app/Config/Routes.php**:

```
// Routes to Email Templates
$routes->group('emails', ['namespace' => '\Tatter\Outbox\Controllers'], function ($routes)
{
	$routes->get('templates/new/(:segment)', 'Templates::new/$1');
	$routes->get('templates/send/(:segment)', 'Templates::send/$1');
	$routes->post('templates/send/(:segment)', 'Templates::send_commit/$1');
	$routes->presenter('templates', ['controller' => 'Templates']);
});
```

Be sure to secure appropriate access to these routes (e.g. with a Filter).

### Tokens

[](#tokens)

Templates use View Parser "tokens" that will be passed through to add your data. The `Template` Entity can do this for you by passing in your data parameters:

```
$template = model(TemplateModel::class)->findByName('Item Purchase');

$subject = $template->renderSubject(['item' => 'Fancy Purse']);
$body    = $template->renderBody(['cost' => '10 dollars']);
```

`renderBody()` will take care of inlining any CSS you have provided and including your template in its parent (if defined).

If you do not need any other configuration you can get a fully prepared version of the `Email` class with rendered and inlined content from the library:

```
$email = $template->email($data);
$email->setTo('jill@example.com')->send();
```

### Cascading Templates

[](#cascading-templates)

Each `Template` may also be created with a "Parent Template". Parent templates need to have a `{body}` token which will receive the parsed content from its child. Additional tokens in the parent template can be entered by defining them in the child.

Cascading templates makes it easy to have a few "layouts" with many different variable messages for each layout. For example, your app may send both newsletters and receipts with their own layout (Parent Template) and then a myriad of different customizable messages for different occasions.

###  Health Score

38

—

LowBetter than 83% of packages

Maintenance21

Infrequent updates — may be unmaintained

Popularity31

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity69

Established project with proven stability

 Bus Factor1

Top contributor holds 98.8% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~54 days

Recently: every ~154 days

Total

15

Last Release

1432d ago

Major Versions

v1.1.5 → v2.0.02020-11-06

PHP version history (3 changes)v1.0PHP &gt;=7.2

v2.0.4PHP ^7.3 || ^8.0

v2.1.1PHP ^7.4 || ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/5ebe908b4fe73807ecdd9f88733342199c9991b7de800329f5b2b787c8210d62?d=identicon)[MGatner](/maintainers/MGatner)

---

Top Contributors

[![MGatner](https://avatars.githubusercontent.com/u/17572847?v=4)](https://github.com/MGatner "MGatner (84 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")

---

Tags

loggingemailcodeigniterinlinecodeigniter4outbox

### Embed Badge

![Health badge](/badges/tatter-outbox/health.svg)

```
[![Health](https://phpackages.com/badges/tatter-outbox/health.svg)](https://phpackages.com/packages/tatter-outbox)
```

###  Alternatives

[monolog/monolog

Sends your logs to files, sockets, inboxes, databases and various web services

21.4k997.8M7.9k](/packages/monolog-monolog)[symfony/monolog-bundle

Symfony MonologBundle

2.9k258.2M1.7k](/packages/symfony-monolog-bundle)[itsgoingd/clockwork

php dev tools in your browser

5.9k29.0M110](/packages/itsgoingd-clockwork)[sentry/sentry

PHP SDK for Sentry (http://sentry.io)

1.9k240.0M314](/packages/sentry-sentry)[sentry/sentry-symfony

Symfony integration for Sentry (http://getsentry.com)

73764.5M84](/packages/sentry-sentry-symfony)[bugsnag/bugsnag-laravel

Official Bugsnag notifier for Laravel applications.

90335.7M37](/packages/bugsnag-bugsnag-laravel)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
