PHPackages                             synergitech/postal - 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. [Mail &amp; Notifications](/categories/mail)
4. /
5. synergitech/postal

ActiveFuel-package[Mail &amp; Notifications](/categories/mail)

synergitech/postal
==================

FuelPHP library to integrate Postal Email sending

v0.2.4(6y ago)26.4k1[1 PRs](https://github.com/SynergiTech/fuelphp-postal/pulls)MITPHP

Since Jun 9Pushed 5y ago2 watchersCompare

[ Source](https://github.com/SynergiTech/fuelphp-postal)[ Packagist](https://packagist.org/packages/synergitech/postal)[ Docs](https://www.synergitech.co.uk)[ RSS](/packages/synergitech-postal/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (10)Dependencies (2)Versions (16)Used By (0)

FuelPHP Postal
==============

[](#fuelphp-postal)

FuelPHP-Postal is designed as a fully featured wrapper to the [Postal](https://github.com/atech/postal) email sending platform.

Currently it handles sending emails, with or without attachments, stores the message ID returned from Postal in a database, and also exposes a webhook receiver to handle notifications from Postal that messages have been delivered, opened etc.

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

[](#installation)

The recommended way to install `fuelphp-postal` is using [Composer](https://getcomposer.org/).

```
# Install Composer
curl -sS https://getcomposer.org/installer | php
```

Next, run the Composer command to install the latest stable version of `fuelphp-postal`.

```
php composer.phar require synergitech/postal
```

You will then need database tables for storing the outbound email details and webhook notifications. We have provided FuelPHP migrations to make this easy.

```
php oil r migrate --packages=postal
```

Configuration
-------------

[](#configuration)

You need to configure your app to point to your Postal instance and the address from which to send. A basic config looks like this:

```
return [
    'url' => 'https://yourpostal.io',
    'api_key' => 'ABCDEFGHI123456790',
    'send-name' => 'Your App Name',
    'send-address' => 'noreply@yourapp.io',
    'reply-to' => 'reply@yourapp.io',
    'template_html' => 'email/generic/html',
    'template_text' => 'email/generic/text'
];
```

The `template_text` and `template_html` will be used by default as the view files into which your `$data` array will be merged using FuelPHP's built in View `render()` function.

You will need to add `postal` to the `config` and `package` autoloaders to ensure they are available to your classes.

You can also define an environment variable in your `.htaccess` file to send all emails to one address which will help you develop your app.

```
SetEnv EMAIL you@company.io

```

You can also achieve this by adding a config value `sendallmessagesto` if you would rather not adjust your environment variables.

```
return [
    // ...
    'sendallmessagesto' => 'you@company.io'
    // ...
];
```

Quick Sending Messages
----------------------

[](#quick-sending-messages)

You can call the `send()` function to send an email. Arguments after `$to` are optional.

```
\Synergitech\Postal::send($subject, $body, $to, $to_name, $from, $data, $bcc);
```

Normal Sending Messages
-----------------------

[](#normal-sending-messages)

If you want to access other features such as headers, attachments, and CC, you can `forge()` a new object which behaves similarly to Postals PHP library. The `$data` and `$from` arguments are optional.

```
$message = \Synergitech\Postal\SendMessage::forge($subject, $body, $data, $from);
```

Now you can use it to fill in the recipients and send. `to()`, `cc()`, and `bcc()` all function the same way.

```
$message->to('customer@example.com');
$message->cc('accounts@example.com', 'Accounts Department');

$message->bcc(array(
    'tom@example.com' => 'Tom',
    'dick@example.com' => 'Dick',
    'harry@example.com' => 'Harry'
));

$message->attach('report.pdf', 'application/pdf', file_get_contents('report.pdf'));

$message->send();
```

If you want to store your message contents in another view file, send a null body and a 'body\_view' item in the `$data` array. The view will receive either an `$is_text` variable or an `$is_html` variable if you need to slightly differentiate between the two.

```
$message = \Synergitech\Postal\SendMessage::forge($subject, null, ['body_view' => $bodyview] + $data);
```

Webhooks
--------

[](#webhooks)

You can configure a webhook receiving URL within Postal. You need to create a controller within your FuelPHP project that calls:

```
\Synergitech\Postal\Webhook::ProcessWebhook();
```

Example Controller file (be sure to allow unauthenticated requests to pass to this function):

```
namespace Controller;

class Webhook extends \Controller_Rest
{
    public function action_postal()
    {
        \Synergitech\Postal\Webhook::ProcessWebhook();
    }
}
```

Logging
-------

[](#logging)

Using this package means you store a history of email messages and the webhooks let you keep updated with the status of those messages.

To make use of the messages as part of an audit trail, you will be interested in the database objects for the messages you have just sent.

You can set `return_email_objects` to `true` and any calls to `send()` will return an array of database objects which you can do with what you wish.

```
$sent = $message->send();

$log = \Model\Audit\Log::forge(array(
    // your specific information here
));

$log->save();

foreach ($sent as $email) {
    \Model\Audit\Item::forge(array(
        'log_id' => $log->id,
        'email_id' => $email->id
    ))->save();
}
```

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity22

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~73 days

Recently: every ~180 days

Total

13

Last Release

2381d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/d69f33cc173ab9f35c67cb1bbaabeb0b705f983f65253393525ccfc539abc260?d=identicon)[SynergiTech](/maintainers/SynergiTech)

---

Top Contributors

[![williamrenfrew](https://avatars.githubusercontent.com/u/12625062?v=4)](https://github.com/williamrenfrew "williamrenfrew (11 commits)")[![willpower232](https://avatars.githubusercontent.com/u/1619102?v=4)](https://github.com/willpower232 "willpower232 (10 commits)")[![forestlovewood](https://avatars.githubusercontent.com/u/22885049?v=4)](https://github.com/forestlovewood "forestlovewood (2 commits)")[![Josh-G](https://avatars.githubusercontent.com/u/487384?v=4)](https://github.com/Josh-G "Josh-G (2 commits)")

---

Tags

fuelphppostal

### Embed Badge

![Health badge](/badges/synergitech-postal/health.svg)

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

###  Alternatives

[synergitech/laravel-postal

This library integrates Postal with the standard Laravel mail framework.

38107.1k](/packages/synergitech-laravel-postal)[dereuromark/cakephp-mailchimp

A CakePHP plugin for MailChimp

2217.9k](/packages/dereuromark-cakephp-mailchimp)[etailors/mautic-amazon-ses

Amazon SES Mailer Plugin for Mautic

522.0k](/packages/etailors-mautic-amazon-ses)

PHPackages © 2026

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