Download the PHP package appletonlearning/laravel-postmark-channel without Composer
On this page you can find all versions of the php package appletonlearning/laravel-postmark-channel. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download appletonlearning/laravel-postmark-channel
More information about appletonlearning/laravel-postmark-channel
Files in appletonlearning/laravel-postmark-channel
Package laravel-postmark-channel
Short Description A Postmark channel for Laravel notifications.
License MIT
Homepage https://github.com/appletonlearning/laravel-postmark-channel
Informations about the package laravel-postmark-channel
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
- Installation
- Setting up the Postmark service
- Usage
- Send an email
- Send a Markdown email
- Tracking notifications
- Security
- Credits
- License
Installation
Requires PHP 7.0+
If using Laravel 5.5+ the package will be auto-discovered.
Setting up the Postmark service
- Get the API key for your server on Postmark
- Add the key to your environment config as
POSTMARK_KEY
Usage
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:
You may now tell Laravel to send notifications using Postmark in the via
method:
Send a Markdown email
Just like regular mail
type notifications, you can also send Markdown emails:
In fact, the Postmark channel has the same API as the built-in Laravel mail
channel. Follow the Laravel Mail Notifications and Markdown Mail Notifications documentation for full options.
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
:
As the Laravel documentation 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...
With Postmark, the $event->response
object contains the ID, status, and other data sent back from Postmark when the email has been sent through their system:
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.
Testing
Security
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
Credits
- Adam Campbell
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
All versions of laravel-postmark-channel with dependencies
wildbit/postmark-php Version ^2.5
illuminate/mail Version 5.5.*|5.6.*
illuminate/notifications Version 5.5.*|5.6.*
illuminate/support Version 5.5.*|5.6.*