Monitored Emails
Description
Monitored Emails connects IMAP or POP inboxes to Laravel Enso and persists unread messages for further application processing.
The package exposes CRUD screens for mailbox configuration, validates remote connectivity from the backoffice, and schedules a recurring fetch cycle that stores unseen messages in the local database.
It is intended for Enso applications that ingest customer or operational inboxes and then continue processing from persisted messages instead of polling mailboxes ad hoc.
Installation
Install the package:
composer require laravel-enso/monitored-emails
Run the package migrations:
php artisan migrate
Features
- Mailbox CRUD, table init, table data, and Excel export endpoints.
- Connectivity test endpoint for validating server, folder, and credentials before saving changes.
- Scheduled
enso:monitored-emails:fetch-unread-emailscommand registered every fifteen minutes. - Queue-backed unread message ingestion through the
FetchUnreadEmailsjob. - Protocol enum for
imap,secureImap,pop3, andsmtp, with default ports. - Encrypted password storage on the monitored mailbox model.
Usage
Configure one or more monitored inboxes from the administration UI and enable them with the is_active flag.
Main route group:
administration.monitoredEmails.*
The package schedules unread-message polling automatically. You can also trigger the fetch manually:
php artisan enso:monitored-emails:fetch-unread-emails
Each configured mailbox resolves an IMAP client through webklex/php-imap, reads unseen messages from the selected folder, stores the raw message metadata in monitored_messages, and marks the remote message as seen.
API
HTTP routes
GET api/administration/monitoredEmails/createPOST api/administration/monitoredEmailsGET api/administration/monitoredEmails/{monitoredEmail}/editPATCH api/administration/monitoredEmails/{monitoredEmail}DELETE api/administration/monitoredEmails/{monitoredEmail}GET api/administration/monitoredEmails/initTableGET api/administration/monitoredEmails/tableDataGET api/administration/monitoredEmails/exportExcelPOST api/administration/monitoredEmails/{monitoredEmail}/testEmail
Artisan commands
enso:monitored-emails:fetch-unread-emails
Queue job
LaravelEnso\\MonitoredEmails\\Jobs\\FetchUnreadEmails
Behavior:
- loads all active monitored inboxes
- connects to each configured mailbox
- fetches unseen messages from the selected folder
- stores persisted message copies locally
- marks remote messages as seen after import
Depends On
Required Enso packages:
Required external packages:
Companion frontend package:
Contributions
are welcome. Pull requests are great, but issues are good too.
Thank you to all the people who already contributed to Enso!