kuantiko / ci4-msgraph-mailer
Provides a new protocol (msgraph) to the Email library enabling sending emails via Microsoft Graph API with OAuth2
Requires
- php: ^8.1
- ext-curl: *
Requires (Dev)
- codeigniter4/devkit: ^1.3
- codeigniter4/framework: ^4.4
- phpunit/phpunit: ^10.5
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:
Clone the repository into your project:
git clone https://bitbucket.org/kuantiko/ci4-msgraph-mailer.git
Add the package to your project's autoloader. Update the
autoload
section in yourcomposer.json
file:"autoload": { "psr-4": { "Kuantiko\\Ci4MsgraphMailer\\": "path/to/ci4-msgraph-mailer/src/" } }
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.