{"id":37233521,"url":"https://github.com/spurwork/laravel-postmark-channel","last_synced_at":"2026-01-15T03:54:32.311Z","repository":{"id":62486363,"uuid":"121546815","full_name":"spurwork/laravel-postmark-channel","owner":"spurwork","description":"A Postmark channel for Laravel notifications.","archived":true,"fork":false,"pushed_at":"2018-02-19T13:45:18.000Z","size":41,"stargazers_count":6,"open_issues_count":2,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-09-16T03:58:12.562Z","etag":null,"topics":["email","laravel","notification-channel","notifications","postmark"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/spurwork.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-02-14T18:38:10.000Z","updated_at":"2023-01-28T11:12:09.000Z","dependencies_parsed_at":"2022-11-02T10:01:13.784Z","dependency_job_id":null,"html_url":"https://github.com/spurwork/laravel-postmark-channel","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/spurwork/laravel-postmark-channel","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spurwork%2Flaravel-postmark-channel","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spurwork%2Flaravel-postmark-channel/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spurwork%2Flaravel-postmark-channel/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spurwork%2Flaravel-postmark-channel/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/spurwork","download_url":"https://codeload.github.com/spurwork/laravel-postmark-channel/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spurwork%2Flaravel-postmark-channel/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28419272,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T10:47:48.104Z","status":"ssl_error","status_checked_at":"2026-01-14T10:46:19.031Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["email","laravel","notification-channel","notifications","postmark"],"created_at":"2026-01-15T03:54:31.758Z","updated_at":"2026-01-15T03:54:32.295Z","avatar_url":"https://github.com/spurwork.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Latest Version on Packagist](https://img.shields.io/packagist/v/appletonlearning/laravel-postmark-channel.svg?style=flat-square)](https://packagist.org/packages/appletonlearning/laravel-postmark-channel)\n[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE.md)\n[![Build Status](https://travis-ci.org/appletonlearning/laravel-postmark-channel.svg?branch=master)](https://travis-ci.org/appletonlearning/laravel-postmark-channel)\n\n# Postmark notification channel for Laravel\n\nThis 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.\n\n## Contents\n\n- [Installation](#installation)\n    - [Setting up the Postmark service](#setting-up-the-Postmark-service)\n- [Usage](#usage)\n    - [Send an email](#send-an-email)\n    - [Send a Markdown email](#send-a-markdown-email)\n    - [Tracking notifications](#tracking-notifications)\n- [Security](#security)\n- [Credits](#credits)\n- [License](#license)\n\n\n## Installation\n\nRequires PHP 7.0+\n\n\n```bash\n$ composer require appletonlearning/laravel-postmark-channel\n```\n\nIf using Laravel 5.5+ the package will be auto-discovered.\n\n### Setting up the Postmark service\n\n1. Get the API key for your server on Postmark\n2. Add the key to your environment config as `POSTMARK_KEY`\n\n## Usage\n\n### Send an email\n\nIn every `Notifiable` model you wish to be notifiable via Postmark you must add an email address to that model accessible through a `routeNotificationForPostmark` method:\n```php\nclass User extends Eloquent\n{\n    use Notifiable;\n\n    public function routeNotificationForPostmark()\n    {\n        return $this-\u003eemail;\n    }\n}\n```\nYou may now tell Laravel to send notifications using Postmark in the `via` method:\n```php\nuse Spur\\Postmark\\PostmarkChannel;\nuse Spur\\Postmark\\PostmarkMessage;\n\nclass InvoiceNotification extends Notification\n{\n    public function via($notifiable)\n    {\n        return [PostmarkChannel::class];\n    }\n\n    public function toPostmark($notifiable)\n    {\n    \t$url = url('/invoice/'.$this-\u003einvoice-\u003eid);\n    \n        return (new PostmarkMessage)\n            -\u003egreeting('Hello!')\n            -\u003eline('One of your invoices has been paid!')\n            -\u003eaction('View Invoice', $url)\n            -\u003eline('Thank you for using our application!');\n    }\n}\n```\n\n### Send a Markdown email\n\nJust like regular `mail` type notifications, you can also send Markdown emails:\n```php\npublic function toPostmark($notifiable)\n{\n    $url = url('/invoice/'.$this-\u003einvoice-\u003eid);\n\n    return (new PostmarkMessage)\n        -\u003esubject('Invoice Paid')\n        -\u003emarkdown('mail.invoice.paid', ['url' =\u003e $url]);\n}\n```\nIn 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.\n\n### Tracking notifications\n\nOne 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`.\n\nTo capture the ID on send we listen to Laravel's `Illuminate\\Notifications\\Events\\NotificationSent` event. Register a listener for this event in your `EventServiceProvider`:\n\n```php\n/**\n * The event listener mappings for the application.\n *\n * @var array\n */\nprotected $listen = [\n    'Illuminate\\Notifications\\Events\\NotificationSent' =\u003e [\n        'App\\Listeners\\LogNotification',\n    ],\n];\n```\n\nAs the [Laravel documentation](https://laravel.com/docs/master/notifications#notification-events) states:\n\u003e 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...\n\n```php\n/**\n * Handle the event.\n *\n * @param  NotificationSent  $event\n * @return void\n */\npublic function handle(NotificationSent $event)\n{\n    // $event-\u003echannel\n    // $event-\u003enotifiable\n    // $event-\u003enotification\n    // $event-\u003eresponse\n}\n```\nWith Postmark, the `$event-\u003eresponse` 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:\n```json\n{\n    \"To\": \"receiver@example.com\",\n    \"SubmittedAt\": \"2014-02-17T07:25:01.4178645-05:00\",\n    \"MessageID\": \"0a129aee-e1cd-480d-b08d-4f48548ff48d\",\n    \"ErrorCode\": 0,\n    \"Message\": \"OK\"\n}\n```\n\nOnce 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).\n\n## Testing\n\n``` bash\n$ composer test\n```\n\n## Security\n\nIf you discover any security related issues, please email adam@spurjobs.com instead of using the issue tracker.\n\n## Credits\n\n- [Adam Campbell](https://github.com/hotmeteor)\n- [All Contributors](../../contributors)\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspurwork%2Flaravel-postmark-channel","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fspurwork%2Flaravel-postmark-channel","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspurwork%2Flaravel-postmark-channel/lists"}