Laravel IMAP
Connect Laravel apps to IMAP and POP3 mailboxes to read and manage email.
Repository Health
Technical Analysis
Laravel IMAP by Webklex is a Laravel package that brings full IMAP and POP3 mailbox access into your application. It wraps both the native PHP IMAP extension and an extended pure-PHP IMAP protocol implementation, so you can connect to mail servers, list folders, fetch and parse messages, and act on them without depending on the C extension.
Beyond simple reading, it supports searching mailboxes, moving and flagging messages, handling attachments, IDLE-based push notifications for new mail, and OAuth authentication for providers like Gmail and Outlook. It ships as a Laravel service provider with a facade and configuration file, integrating cleanly with the framework’s conventions.
What You Get
- A Laravel service provider, facade, and publishable config for IMAP/POP3 accounts
- A fluent message-query API for searching mailboxes by criteria
- Message parsing for headers, bodies, and attachments
- Folder operations plus moving, copying, flagging, and deleting messages
- IDLE support for real-time new-mail notifications and OAuth authentication
Common Use Cases
- Reading and processing incoming support emails inside a Laravel app
- Syncing or archiving mailbox contents into application storage
- Building ticketing or helpdesk workflows driven by email
- Monitoring an inbox in real time with IMAP IDLE
Under The Hood
Architecture — The package centers on a ClientManager and Client that open connections through a pluggable protocol layer: either the native php-imap extension or a bundled pure-PHP IMAP/POP3 protocol implementation. A Client yields Folder objects, which expose a fluent Query builder that compiles search criteria into IMAP commands and returns Message objects with parsed Attachment, Header, and address components. A Laravel ServiceProvider wires configuration and a Facade into the framework.
Tech Stack — PHP targeting modern Laravel versions, distributed via Composer/Packagist. It can use the native IMAP C extension when available but also provides its own protocol layer so it works without it. OAuth flows are supported for providers such as Gmail and Outlook.
Code Quality — A mature, widely used package (700+ stars, 490+ commits, 85 releases, 36 contributors, ~228K monthly installs) with published documentation on php-imap.com and Scrutinizer code-quality tracking. Recent development activity has slowed, but the API is stable and well established.
API Design — The developer experience follows Laravel idioms: publish a config, resolve a client from the container or facade, and chain query methods (->query()->since()->get()) to fetch messages. The abstraction hides raw IMAP command details while still exposing folders, flags, and attachments directly.