Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Postmark Mailer

Postmark Mailer Laravel Package

symfony/postmark-mailer

Symfony Mailer transport for Postmark. Send transactional email through Postmark using Symfony’s mailer API, with straightforward configuration and support for Postmark-specific options and headers. Ideal for Symfony apps needing reliable delivery and tracking.

Deep Wiki
Context7

The symfony/postmark-mailer package adds a Postmark transport to Symfony’s Mailer component, enabling reliable transactional email delivery via Postmark’s API while using the familiar Symfony mailer workflow. It’s designed for straightforward configuration and seamless integration in Symfony apps that already rely on Mailer.

Key features:

  • Postmark Mailer transport compatible with Symfony Mailer
  • Simple DSN-based configuration (API token, options)
  • Supports standard Email messages, headers, and metadata
  • Leverages Symfony’s transport and event ecosystem
  • Suitable for transactional email delivery and monitoring via Postmark
Frequently asked questions about Postmark Mailer
Can I use symfony/postmark-mailer directly in Laravel without modifying core files?
No, this package isn’t Laravel-native. You’ll need to create a custom transport class (e.g., `PostmarkTransport`) extending Laravel’s `Swift_Transport` or use PSR-15 middleware to bridge Symfony’s Mailer with Laravel’s Mail facade. This requires minimal core changes but adds flexibility for retries and event handling.
What Laravel versions support symfony/postmark-mailer?
The package works with Laravel 10.x+ due to Symfony Mailer 6.x compatibility. For older Laravel versions (e.g., 9.x), you’d need to manually resolve dependency conflicts or use a wrapper like `spatie/laravel-postmark` instead, which offers tighter integration.
How do I configure Postmark’s SMTP fallback if their API is down?
Use Laravel’s queue system to retry failed API calls, then fall back to SMTP via Symfony’s Dsn (e.g., `postmark+smtp://api_key@client_id`). Configure this in your `PostmarkTransport` class by checking API response codes and switching drivers dynamically.
Does this package support Postmark’s inbox preview tokens or message streams?
Yes, but you’ll need to extend Laravel’s `Mailable` or `Notification` classes to inject Postmark-specific metadata (e.g., preview tokens) during message composition. Use Symfony’s `TemplatedEmail` to dynamically populate template variables for message streams.
Can I queue emails with Postmark via Laravel’s queue workers?
Absolutely. Wrap Postmark API calls in a Laravel job (e.g., `SendWithPostmark`) and dispatch them via `Mail::to()->send()` with the `queue` method. This leverages Laravel’s queue drivers (database/Redis) for retries and monitoring.
What’s the performance impact of using Symfony Mailer in Laravel?
Minimal if configured correctly. Symfony Mailer’s overhead is offset by its robust features (e.g., retries, event dispatching). Benchmark your setup by comparing latency between direct Postmark API calls (via Guzzle) and this package—differences are typically under 100ms for most use cases.
How do I test Postmark email delivery in Laravel’s CI pipeline?
Mock the `PostmarkTransport` class in PHPUnit to intercept API calls, then assert message composition and queue dispatch. Use Laravel’s `MailFake` for SMTP tests, but replace it with a custom `PostmarkFakeTransport` for API-specific validation.
Is there a simpler alternative to symfony/postmark-mailer for Laravel?
Yes, consider `spatie/laravel-postmark` for tighter Laravel integration (e.g., built-in queue support, notifications). However, it lacks Symfony’s advanced features like event dispatching or hybrid SMTP/API fallbacks. Choose based on whether you prioritize simplicity or robustness.
How do I handle Postmark’s API rate limits in a Laravel app?
Implement circuit breakers (e.g., `spatie/laravel-circuitbreaker`) to pause retries during failures. Configure exponential backoff in your `PostmarkTransport` class, and log rate-limit events to Laravel’s `failed_jobs` table for monitoring.
Can I use this package with Laravel Notifications (e.g., password resets)?
Yes, extend Laravel’s `Mailable` or override the `via()` method in notifications to use your `PostmarkTransport`. For example: `public function via($notifiable) { return [new PostmarkChannel]; }`. This ensures notifications use Postmark’s API while retaining Laravel’s queue and retry logic.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport