- Can I use symfony/postmark-mailer directly in Laravel without Symfony’s full stack?
- Yes, but you’ll need a custom transport layer. Laravel’s Mail facade expects Swiftmailer transports, so wrap symfony/mailer’s Postmark transport in a Laravel-compatible class. Alternatively, use Symfony Mailer as a microservice via HTTP API calls.
- What Laravel versions support symfony/postmark-mailer?
- Laravel 10+ (PHP 8.2+) works natively. For Laravel 9 or older, use Symfony 6.4 (PHP 8.1) but expect minor compatibility quirks. PHP 8.4+ aligns with Symfony 8.1+, future-proofing your stack.
- How do I configure Postmark’s SMTP vs. API in Laravel?
- Set the `MAILER_DSN` in your `.env` to either `postmark+smtp://TOKEN@default` or `postmark+api://TOKEN@default`. For Laravel, inject the DSN into Symfony’s Mailer transport via a custom transport class or service provider.
- Does this package support Postmark’s Inbound Parsing or Message Streams?
- Yes, but indirectly. Use Postmark’s API (via `postmark+api://`) to trigger webhooks for Inbound Parsing. Message Streams require Postmark’s API to fetch/send messages, which this package enables through Symfony’s Mailer events.
- How do I test email sends in Laravel with this package?
- Mock Symfony’s Mailer transport in tests by creating a test double for the Postmark transport. Use Postmark’s sandbox mode (with a test API key) to validate API calls without real sends. For SMTP, mock the DSN connection.
- What’s the fallback if Postmark’s API/SMTP fails in production?
- Configure Laravel’s queue retries (e.g., `maxAttempts`) and dead-letter queues for failed jobs. The package handles Postmark API errors gracefully (e.g., payload size limits), but ensure your Laravel app logs and alerts on transport failures.
- Is symfony/postmark-mailer better than Guzzle + Postmark API for Laravel?
- If you only need basic email sends, Guzzle + Postmark’s API might suffice. This package adds Symfony’s Mailer features (templates, events, transports) and Postmark-specific integrations (Inbound Parsing). Choose it for enterprise-grade reliability.
- How do I integrate Postmark templates into Laravel’s Mailables?
- Use Symfony’s `Email` class to load Postmark templates via `->htmlTemplate()`. In Laravel, extend your `Mailable` class to convert to Symfony’s `Email` object before sending, or use a custom transport to handle template rendering.
- Can I use this for marketing emails (e.g., A/B testing) in Laravel?
- Yes, but requires setup. Postmark’s A/B testing is API-driven; use Symfony’s Mailer events to trigger Postmark API calls. For Laravel, bind Postmark’s campaign IDs to your `Mailable` classes or use a service layer to manage campaigns.
- What’s the performance impact of using Symfony Mailer in Laravel?
- Minimal for most use cases. Symfony Mailer adds ~10MB to your dependencies but optimizes for async sends (e.g., Laravel queues). For high-volume apps, consider a microservice architecture to isolate Symfony Mailer’s overhead.