- Can I use ImapEngine in Laravel without the PHP IMAP extension?
- Yes, ImapEngine is a pure PHP implementation and doesn’t require the PHP IMAP extension. This makes it portable across environments like Docker, serverless, or platforms without native IMAP support.
- How do I connect to an IMAP server like Gmail or Office 365?
- Configure your connection via Laravel’s config files or environment variables. Use the `ImapClient` class with credentials (host, port, SSL, username, password) and authenticate. Example: `$client = new ImapClient(['host' => 'imap.gmail.com', 'ssl' => true, ...]);`
- Does ImapEngine support searching messages by date, size, or flags?
- Yes, it supports advanced IMAP search criteria like `SENT SINCE`, `LARGER`, `SMALLER`, and flags (e.g., `\Seen`, `\Flagged`). Use methods like `$folder->search(['SINCE' => '15-Oct-2023'])` for filtering.
- How do I handle attachments from IMAP messages in Laravel?
- Attachments are parsed into `Attachment` objects with metadata (filename, MIME type, size). You can save them manually to Laravel storage (e.g., `Storage::disk('s3')->put()`) or process them in-memory. No built-in storage integration exists—custom logic is required.
- Is ImapEngine compatible with Laravel 10 and PHP 8.2+?
- Yes, ImapEngine supports modern PHP (8.1+) and Laravel 9/10. It uses type safety (e.g., `BackedEnum`) and PHPStan compliance. Check the package’s `composer.json` for exact version requirements.
- Can I use ImapEngine for real-time email processing (e.g., webhooks)?
- ImapEngine supports polling (`$folder->poll()`) and idle operations, but real-time processing requires persistent connections. For Laravel, consider wrapping it in a queue job (e.g., Horizon) or using Laravel Echo for push notifications.
- How do I manage multiple IMAP accounts or connection pooling?
- ImapEngine doesn’t include built-in pooling, but you can manually manage connections via Laravel’s service container (e.g., `singleton` or `contextual binding`). For high concurrency, use a container like `pimple/di` or a dedicated IMAP client wrapper.
- Are there alternatives to ImapEngine for Laravel IMAP support?
- Alternatives include `spatie/laravel-imap` (Laravel-specific wrapper) or raw PHP’s `imap_*` functions. ImapEngine stands out for its pure PHP implementation, modern API, and Laravel ecosystem alignment (e.g., Collections, Carbon).
- How do I debug IMAP connection issues or malformed emails?
- Use `spatie/ray` or Laravel Telescope to log IMAP operations. For malformed emails, validate with `nesbot/carbon` for dates or `symfony/mime` for headers. Handle exceptions like `ImapConnectionFailedException` with retry logic.
- Does ImapEngine support server-side sorting or bulk operations?
- Yes, it supports server-side sorting (e.g., `SORT DATE`) and bulk actions like flagging or deleting messages. For large datasets, use lazy loading (`$folder->messages()->limit(100)`) to avoid memory issues.