- How do I integrate SendPulse Mailer into an existing Laravel app using Laravel Mail?
- Use the package’s DSN configuration in `.env` (e.g., `MAIL_MAILER=sendpulse` and `MAILER_DSN=sendpulse+smtp-api://USER_ID:SECRET@default`). The package leverages Laravel’s built-in `Mail` facade, so no changes are needed to your existing `Mailable` classes or `Mail::send()` calls.
- Does this package support SendPulse’s Automation360 events for marketing campaigns?
- Yes, the package supports Automation360 events via the `sendpulse+events://` DSN scheme. Configure it in `.env` and use custom headers like `X-SendPulse-Event` in your email messages to trigger SendPulse automation workflows.
- What Laravel and PHP versions are compatible with this package?
- The package requires PHP 8.0+ and is designed for Laravel 9+ (which uses Symfony Mailer 6.x). If your app uses Laravel 8.x or PHP 7.x, you’ll need to upgrade or check for Symfony Mailer version conflicts, as the package depends on Symfony Mailer ^4.4|^5.0|^6.0.
- Can I use this package alongside other Laravel mail drivers (e.g., SMTP, Mailgun)?
- Yes, the package works alongside other drivers. Simply switch the `MAIL_MAILER` value in `.env` to toggle between drivers (e.g., `sendpulse`, `smtp`, or `mailgun`). No code changes are required for driver switching.
- How do I handle custom headers like `SendPulseVariableHeader` in Laravel’s Mailable classes?
- Use the `SendPulseVariableHeader` class to inject dynamic variables into emails. In your `Mailable` class, modify the `build` method to add headers like `$this->headers->add(new SendPulseVariableHeader('key', 'value'))`. This works seamlessly with Laravel’s `Mailable` structure.
- What are the risks of using this package in production with high email volumes?
- SendPulse’s API has rate limits, so test under load to avoid throttling. Use Laravel Queues to batch emails and handle retries for failed sends. Monitor failed emails via Laravel’s logging or integrate a third-party tool like Sentry for alerts.
- Is there a way to mock SendPulse responses for testing in Laravel?
- Yes, use Laravel’s `MailFake` (for unit tests) or `Pest`/`PHPUnit` to mock the `MailerInterface`. Override the `send()` method in tests to simulate SendPulse responses without hitting their API. This ensures your app behaves correctly before deployment.
- Does this package support email logging or tracking (e.g., open rates, failed sends)?
- The package itself doesn’t include built-in logging for SendPulse-specific metrics, but you can log failed sends using Laravel’s `Log` facade. For open rates or advanced analytics, use SendPulse’s webhooks or integrate their API directly in your app.
- What if I encounter conflicts with Symfony Mailer versions in my Laravel app?
- If your Laravel app bundles a different Symfony Mailer version (e.g., Laravel 10 uses 6.4), you may need to use Composer overrides or patches. Check the package’s `composer.json` for supported Symfony Mailer versions and adjust your `composer.json` accordingly.
- Are there alternatives to this package for SendPulse integration in Laravel?
- Yes, consider `spatie/laravel-sendpulse`, which offers a more mature solution with better documentation, testing, and MIT licensing (vs. GPL-3.0). Evaluate whether you need SendPulse’s Automation360 events or if SMTP API alone suffices before choosing.