PHPackages                             appletonlearning/laravel-postmark-channel - 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. appletonlearning/laravel-postmark-channel

AbandonedArchivedLibrary[Mail &amp; Notifications](/categories/mail)

appletonlearning/laravel-postmark-channel
=========================================

A Postmark channel for Laravel notifications.

v1.0.4(8y ago)626[2 issues](https://github.com/spurwork/laravel-postmark-channel/issues)MITPHPPHP &gt;=7.0

Since Feb 14Pushed 8y agoCompare

[ Source](https://github.com/spurwork/laravel-postmark-channel)[ Packagist](https://packagist.org/packages/appletonlearning/laravel-postmark-channel)[ Docs](https://github.com/appletonlearning/laravel-postmark-channel)[ RSS](/packages/appletonlearning-laravel-postmark-channel/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (5)Dependencies (6)Versions (6)Used By (0)

[![Latest Version on Packagist](https://camo.githubusercontent.com/21b6147a3183ff2c79248d954d26d497608de4c5e5827f51173816c1d1df7447/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6170706c65746f6e6c6561726e696e672f6c61726176656c2d706f73746d61726b2d6368616e6e656c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/appletonlearning/laravel-postmark-channel)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/cb3cdeb3afaf467b5a532bfe348c72d8e3dbb4bb447d43e0f85fe8295891c285/68747470733a2f2f7472617669732d63692e6f72672f6170706c65746f6e6c6561726e696e672f6c61726176656c2d706f73746d61726b2d6368616e6e656c2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/appletonlearning/laravel-postmark-channel)

Postmark notification channel for Laravel
=========================================

[](#postmark-notification-channel-for-laravel)

This adds a Postmark notification channel for Laravel that allows your app to leverage the Postmark API for tracking events related to your emails, like opens, bounces, clicks, etc.

Contents
--------

[](#contents)

- [Installation](#installation)
    - [Setting up the Postmark service](#setting-up-the-Postmark-service)
- [Usage](#usage)
    - [Send an email](#send-an-email)
    - [Send a Markdown email](#send-a-markdown-email)
    - [Tracking notifications](#tracking-notifications)
- [Security](#security)
- [Credits](#credits)
- [License](#license)

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

[](#installation)

Requires PHP 7.0+

```
$ composer require appletonlearning/laravel-postmark-channel
```

If using Laravel 5.5+ the package will be auto-discovered.

### Setting up the Postmark service

[](#setting-up-the-postmark-service)

1. Get the API key for your server on Postmark
2. Add the key to your environment config as `POSTMARK_KEY`

Usage
-----

[](#usage)

### Send an email

[](#send-an-email)

In every `Notifiable` model you wish to be notifiable via Postmark you must add an email address to that model accessible through a `routeNotificationForPostmark` method:

```
class User extends Eloquent
{
    use Notifiable;

    public function routeNotificationForPostmark()
    {
        return $this->email;
    }
}
```

You may now tell Laravel to send notifications using Postmark in the `via` method:

```
use Spur\Postmark\PostmarkChannel;
use Spur\Postmark\PostmarkMessage;

class InvoiceNotification extends Notification
{
    public function via($notifiable)
    {
        return [PostmarkChannel::class];
    }

    public function toPostmark($notifiable)
    {
    	$url = url('/invoice/'.$this->invoice->id);

        return (new PostmarkMessage)
            ->greeting('Hello!')
            ->line('One of your invoices has been paid!')
            ->action('View Invoice', $url)
            ->line('Thank you for using our application!');
    }
}
```

### Send a Markdown email

[](#send-a-markdown-email)

Just like regular `mail` type notifications, you can also send Markdown emails:

```
public function toPostmark($notifiable)
{
    $url = url('/invoice/'.$this->invoice->id);

    return (new PostmarkMessage)
        ->subject('Invoice Paid')
        ->markdown('mail.invoice.paid', ['url' => $url]);
}
```

In fact, the Postmark channel has the same API as the built-in Laravel `mail` channel. Follow the Laravel [Mail Notifications](https://laravel.com/docs/master/notifications#mail-notifications) and [Markdown Mail Notifications](https://laravel.com/docs/master/notifications#markdown-mail-notifications) documentation for full options.

### Tracking notifications

[](#tracking-notifications)

One of the benefits of using the Postmark channel over the default `mail` channel is that allows for event tracking, such as deliveries, clicks, opens, and bounces on sent emails. To track email events you must first store each notification in your database, which must at least have a column to track the email's Postmark-specific `MessageID`.

To capture the ID on send we listen to Laravel's `Illuminate\Notifications\Events\NotificationSent` event. Register a listener for this event in your `EventServiceProvider`:

```
/**
 * The event listener mappings for the application.
 *
 * @var array
 */
protected $listen = [
    'Illuminate\Notifications\Events\NotificationSent' => [
        'App\Listeners\LogNotification',
    ],
];
```

As the [Laravel documentation](https://laravel.com/docs/master/notifications#notification-events) states:

> Within an event listener, you may access the notifiable, notification, and channel properties on the event to learn more about the notification recipient or the notification itself...

```
/**
 * Handle the event.
 *
 * @param  NotificationSent  $event
 * @return void
 */
public function handle(NotificationSent $event)
{
    // $event->channel
    // $event->notifiable
    // $event->notification
    // $event->response
}
```

With Postmark, the `$event->response` object contains the ID, status, and other [data sent back from Postmark](https://postmarkapp.com/developer/api/email-api) when the email has been sent through their system:

```
{
    "To": "receiver@example.com",
    "SubmittedAt": "2014-02-17T07:25:01.4178645-05:00",
    "MessageID": "0a129aee-e1cd-480d-b08d-4f48548ff48d",
    "ErrorCode": 0,
    "Message": "OK"
}
```

Once your emails are being successfully stored with Postmark's `MessageID` it becomes very easy to track all events that occur with each email using the [Postmark Webhooks API](https://postmarkapp.com/developer/webhooks/webhooks-overview).

Testing
-------

[](#testing)

```
$ composer test
```

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Adam Campbell](https://github.com/hotmeteor)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance13

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 100% 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 ~1 days

Total

5

Last Release

3007d ago

PHP version history (2 changes)v1.0.0PHP &gt;=7.0

v1.0.3PHP &gt;=5.6.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/9a359353ddbcb93df5c0ad8a00e25d54443ea6e8edaef61a3fea5c64ac7774d3?d=identicon)[hotmeteor](/maintainers/hotmeteor)

---

Top Contributors

[![hotmeteor](https://avatars.githubusercontent.com/u/378585?v=4)](https://github.com/hotmeteor "hotmeteor (12 commits)")

---

Tags

emaillaravelnotification-channelnotificationspostmark

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/appletonlearning-laravel-postmark-channel/health.svg)

```
[![Health](https://phpackages.com/badges/appletonlearning-laravel-postmark-channel/health.svg)](https://phpackages.com/packages/appletonlearning-laravel-postmark-channel)
```

###  Alternatives

[s-ichikawa/laravel-sendgrid-driver

This library adds a 'sendgrid' mail driver to Laravel.

4139.3M1](/packages/s-ichikawa-laravel-sendgrid-driver)[laravel-notification-channels/telegram

Telegram Notifications Channel for Laravel

1.1k3.4M35](/packages/laravel-notification-channels-telegram)[laravel-notification-channels/webpush

Web Push Notifications driver for Laravel.

7984.5M16](/packages/laravel-notification-channels-webpush)[fedeisas/laravel-mail-css-inliner

Inline the CSS of your HTML emails using Laravel

5974.6M3](/packages/fedeisas-laravel-mail-css-inliner)[laravel-notification-channels/twilio

Provides Twilio notification channel for Laravel

2587.7M12](/packages/laravel-notification-channels-twilio)[laravel-notification-channels/apn

Apple APN Push Notification Channel

2021.9M4](/packages/laravel-notification-channels-apn)

PHPackages © 2026

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