kuantiko/ci4-msgraph-mailer

Provides a new protocol (msgraph) to the Email library enabling sending emails via Microsoft Graph API with OAuth2

v1.0.0 2025-06-06 10:13 UTC

This package is not auto-updated.

Last update: 2025-06-10 12:02:57 UTC


README

Installation

To install this package, use Composer. Run the following command in your terminal:

composer require kuantiko/ci4-msgraph-mailer

Manual Installation

If you prefer to install the package manually, follow these steps:

  1. Clone the repository into your project:

    git clone https://bitbucket.org/kuantiko/ci4-msgraph-mailer.git
    
  2. Add the package to your project's autoloader. Update the autoload section in your composer.json file:

    "autoload": {
        "psr-4": {
            "Kuantiko\\Ci4MsgraphMailer\\": "path/to/ci4-msgraph-mailer/src/"
        }
    }
    
  3. Run the Composer dump-autoload command to regenerate the autoloader:

    composer dump-autoload
    

Configuration

After installing the package, you need to configure the required values for it to work properly with the Microsoft Graph API.

Make sure to set the email.protocol config key to msgraph protocol and provide the following values in the .env file:

  • graphTenantId: The Azure AD tenant ID.
  • graphClientId: The client ID registered in Azure AD.
  • graphClientSecret: The client secret registered in Azure AD.

Example configuration:

# Email
email.protocol='msgraph'

# GraphMailer
graphmailer.graphTenantId='your-tenant-id',
graphmailer.graphClientId='your-client-id',
graphmailer.graphClientSecret='your-client-secret',

Usage

Once configured, you can use the original \Codeigniter\Email\Email methods to configure and send emails through the Microsoft Graph API.

Contributions

Docker Support

This project includes Docker support for a consistent development environment. You can use the provided docker-compose.yml file to build and run the application in a containerized setup.

To start the Docker environment, run:

docker-compose up -d --build

This will set up the PHP-FPM service with Xdebug enabled for development. Ensure you have Docker and Docker Compose installed on your system before running the command.