opscale-co / nova-mailbox
Capture and process emails in your Nova app
Installs: 0
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/opscale-co/nova-mailbox
Requires
- php: >=8.2
- beyondcode/laravel-mailbox: ^5.0
- opscale-co/actions: ^1.0
- opscale-co/nova-dynamic-resources: ^1.4
- opscale-co/nova-package-tools: ^1.0
- theriddleofenigma/laravel-model-validation: ^1.6
Requires (Dev)
- laravel/nova: ^5.4
- laravel/nova-devtool: ^1.0
- phpunit/phpunit: ^10.5
- tightenco/duster: ^2.7
README
At Opscale, we’re passionate about contributing to the open-source community by providing solutions that help businesses scale efficiently. If you’ve found our tools helpful, here are a few ways you can show your support:
⭐ Star this repository to help others discover our work and be part of our growing community. Every star makes a difference!
💬 Share your experience by leaving a review on Trustpilot or sharing your thoughts on social media. Your feedback helps us improve and grow!
📧 Send us feedback on what we can improve at feedback@opscale.co. We value your input to make our tools even better for everyone.
🙏 Get involved by actively contributing to our open-source repositories. Your participation benefits the entire community and helps push the boundaries of what’s possible.
💼 Hire us if you need custom dashboards, admin panels, internal tools or MVPs tailored to your business. With our expertise, we can help you systematize operations or enhance your existing product. Contact us at hire@opscale.co to discuss your project needs.
Thanks for helping Opscale continue to scale! 🚀
Description
Nova Mailbox captures and processes inbound emails in your Nova app. It stores emails and attachments, and supports extraction rules to automatically extract structured data from incoming messages.
Installation
You can install the package in to a Laravel app that uses Nova via composer:
composer require opscale-co/nova-mailbox
Run the install command:
php artisan mailbox:install
Register the tool in the tools method of your NovaServiceProvider:
// in app/Providers/NovaServiceProvider.php public function tools() { return [ new \Opscale\NovaMailbox\Tool(), ]; }
Configuration
The configuration file is published at config/mailbox.php:
return [ // Storage path for emails and attachments (relative to disk) 'path' => env('MAILBOX_STORAGE_PATH', 'mailbox'), // Extraction rules: classes implementing the Extractor interface 'extraction_rules' => [ // \App\Extractors\MyExtractor::class, ], ];
Templates
Extractions use templates from Nova Dynamic Resources to define their fields. Refer to the composition example for setting up templates.
Extraction Rules
You can create custom extraction rules by implementing the Extractor interface. Each rule defines when it should match an inbound email and how to process it.
use BeyondCode\Mailbox\InboundEmail; use Opscale\NovaMailbox\Contracts\Extractor; use Opscale\NovaMailbox\Models\Email; use Opscale\NovaMailbox\Models\Extraction; class MyExtractor implements Extractor { public function matches(InboundEmail $email): bool { // Return true if this rule should process the email } public function process(InboundEmail $email): ?Extraction { // Extract data and create an Extraction record // Use $email->id() to find the stored Email record: $record = Email::where('message_id', $email->id())->firstOrFail(); return Extraction::create([ 'email_id' => $record->id, 'template_id' => $template->id, 'status' => ExtractionStatus::Completed, 'data' => [ // extracted fields ], ]); } }
Register your extractor in config/mailbox.php:
'extraction_rules' => [ \App\Extractors\MyExtractor::class, ],
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email development@opscale.co instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.
