Skip to main content

Mailbox

The Mailbox module adds support for connecting and synchronizing external mailboxes directly within your Qore application.
Currently, the module supports Microsoft Graph API mailboxes.

The module integrates seamlessly with the Qore/CRM module to link emails to contacts and organizations,
and has optional integration with the Qore/Contact-Reports module for attaching emails to contact reports.


Installation

warning

This module relies on the Qore/CRM, Qore/Glue and Qore/Microsoft-Graph modules/plugins.
Without these dependencies, the Mailbox module will not function correctly.
Optional integration is available with the Qore/Contact-Reports module.

To install this module

composer require qore/mailbox

After installation, publish the module’s assets to your Qore application.

php artisan vendor:publish --tag=qore.mailbox.config --force
php artisan vendor:publish --tag=qore.mailbox.db --force
php artisan vendor:publish --tag=qore.mailbox.frontend --force

Once the files have been published, run the migrations:

php artisan tenants:migrate

Showing the resources in the sidebar

To make both email-related resources visible in your application menus, you’ll need to add the following code to your GlobalsController (or wherever your global menu items are defined).
This will display both the User Mailbox and the Shared Mailbox in the navigation.

if (module_is_active('qore/mailbox')) {
$group->addResourceMenuItem(inbound_emails_resource_instance(),
function (MenuItem $item) {
$item->setLabel(__('User mailbox'));
}
);

$group->addResourceMenuItem(shared_emails_resource_instance(),
function (MenuItem $item) {
$item->setLabel(__('Shared mailbox'));
}
);
}

Initial Setup

After installation and migration, you will need to enable the Mailbox module in your Qore application.

  1. Navigate to Settings → Modules
  2. Locate the Mailbox module
  3. Click Enable

Microsoft Graph Setup

Before you can connect mailboxes, ensure that the Microsoft Graph integration is configured and active.

  1. Open the Microsoft Graph plugin settings in your Qore application
  2. Fill in your API credentials (Client ID, Tenant ID, and Secret)
  3. Verify that the connection is working correctly

Once the Microsoft Graph integration is properly configured, you can begin adding and synchronizing mailboxes.


Setting a Custom Webhook Endpoint or Disabling Webhooks for Local Environments

You can customize or disable the Microsoft Graph webhook endpoint through your .env file.

By default, the system automatically determines the webhook URL using Laravel’s route() helper. However, for local development or testing with public tunnels (such as Expose or Ngrok), you can override this behavior by setting the following environment variables:

MAILBOX_GRAPH_WEBHOOK_URL=https://custom-url.com/api/graph/webhook # Defaults to your app url

MAILBOX_GRAPH_WEBHOOK_ENABLED=false # Defaults to true

Notes

  • When MAILBOX_GRAPH_WEBHOOK_URL is not defined, the application will automatically fall back to the default route generated by route().
  • Set MAILBOX_GRAPH_WEBHOOK_ENABLED=false to disable webhook registration and processing — ideal for local or offline development environments.
  • After updating your .env file, make sure to refresh the configuration cache:
php artisan optimize:clear

Local Development Requirements

⚠️ Important:
The built-in PHP server (php artisan serve) does not support parallel requests, which are required for webhook communication and validation.

To test webhooks locally, use one of the following options instead:

  • Laravel Herd (recommended for macOS)
  • Docker with Nginx or Apache
  • Laravel Valet or Symfony CLI

These environments support concurrent connections, allowing webhook requests to be received and processed correctly.