{"id":38702287,"url":"https://github.com/maize-tech/laravel-msgraph-mailer","last_synced_at":"2026-01-21T20:00:29.615Z","repository":{"id":332955953,"uuid":"1134872390","full_name":"maize-tech/laravel-msgraph-mailer","owner":"maize-tech","description":"A Laravel mail transport driver for sending emails via Microsoft Graph API using OAuth2 authentication.","archived":false,"fork":false,"pushed_at":"2026-01-19T16:41:09.000Z","size":47,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-01-21T02:47:16.351Z","etag":null,"topics":["azure","email","laravel","mail","mailer","microsoft-graph","oauth2","office-365","transport"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/maize-tech.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":"Maize"}},"created_at":"2026-01-15T10:21:36.000Z","updated_at":"2026-01-20T08:42:41.000Z","dependencies_parsed_at":"2026-01-17T04:01:57.707Z","dependency_job_id":null,"html_url":"https://github.com/maize-tech/laravel-msgraph-mailer","commit_stats":null,"previous_names":["maize-tech/laravel-msgraph-mailer"],"tags_count":1,"template":false,"template_full_name":"spatie/package-skeleton-laravel","purl":"pkg:github/maize-tech/laravel-msgraph-mailer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maize-tech%2Flaravel-msgraph-mailer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maize-tech%2Flaravel-msgraph-mailer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maize-tech%2Flaravel-msgraph-mailer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maize-tech%2Flaravel-msgraph-mailer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/maize-tech","download_url":"https://codeload.github.com/maize-tech/laravel-msgraph-mailer/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maize-tech%2Flaravel-msgraph-mailer/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28641293,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-21T18:04:35.752Z","status":"ssl_error","status_checked_at":"2026-01-21T18:03:55.054Z","response_time":86,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["azure","email","laravel","mail","mailer","microsoft-graph","oauth2","office-365","transport"],"created_at":"2026-01-17T10:50:18.244Z","updated_at":"2026-01-21T20:00:29.396Z","avatar_url":"https://github.com/maize-tech.png","language":"PHP","funding_links":["https://github.com/sponsors/Maize"],"categories":[],"sub_categories":[],"readme":"# Laravel Microsoft Graph Mailer\n\n[![Latest Version on Packagist](https://img.shields.io/packagist/v/maize-tech/laravel-msgraph-mailer.svg?style=flat-square)](https://packagist.org/packages/maize-tech/laravel-msgraph-mailer)\n[![GitHub Tests Action Status](https://img.shields.io/github/actions/workflow/status/maize-tech/laravel-msgraph-mailer/run-tests.yml?branch=main\u0026label=tests\u0026style=flat-square)](https://github.com/maize-tech/laravel-msgraph-mailer/actions?query=workflow%3Arun-tests+branch%3Amain)\n[![GitHub Code Style Action Status](https://img.shields.io/github/actions/workflow/status/maize-tech/laravel-msgraph-mailer/fix-php-code-style-issues.yml?branch=main\u0026label=code%20style\u0026style=flat-square)](https://github.com/maize-tech/laravel-msgraph-mailer/actions?query=workflow%3A\"Fix+PHP+code+style+issues\"+branch%3Amain)\n[![Total Downloads](https://img.shields.io/packagist/dt/maize-tech/laravel-msgraph-mailer.svg?style=flat-square)](https://packagist.org/packages/maize-tech/laravel-msgraph-mailer)\n\nA Laravel mail transport driver for sending emails via Microsoft Graph API using OAuth2 authentication.\n\nThis package provides a custom Symfony Mailer transport that integrates seamlessly with Laravel's mail system, allowing you to send emails through Microsoft 365 (formerly Office 365) using the Microsoft Graph API with application permissions (client credentials flow).\n\n## Installation\n\nYou can install the package via composer:\n\n```bash\ncomposer require maize-tech/laravel-msgraph-mailer\n```\n\n## Configuration\n\nAdd the Microsoft Graph mailer configuration to your `config/mail.php` file:\n\n```php\n'mailers' =\u003e [\n    // ... other mailers\n\n    'microsoft-graph' =\u003e [\n        'transport' =\u003e 'microsoft-graph',\n        'tenant_id' =\u003e env('MICROSOFT_GRAPH_TENANT_ID'),\n        'client_id' =\u003e env('MICROSOFT_GRAPH_CLIENT_ID'),\n        'client_secret' =\u003e env('MICROSOFT_GRAPH_CLIENT_SECRET'),\n    ],\n],\n```\n\nAdd the required environment variables to your `.env` file:\n\n```env\nMAIL_MAILER=microsoft-graph\n\nMICROSOFT_GRAPH_TENANT_ID=your-tenant-id\nMICROSOFT_GRAPH_CLIENT_ID=your-client-id\nMICROSOFT_GRAPH_CLIENT_SECRET=your-client-secret\n```\n\n## Usage\n\nOnce configured, you can use Laravel's Mail facade as usual. The package will automatically handle OAuth2 authentication and send emails via Microsoft Graph API.\n\n### Basic Email\n\n```php\nuse Illuminate\\Support\\Facades\\Mail;\n\nMail::raw('Hello from Microsoft Graph!', function ($message) {\n    $message-\u003eto('recipient@example.com')\n            -\u003esubject('Test Email');\n});\n```\n\n### Using Mailables\n\n```php\nuse Illuminate\\Support\\Facades\\Mail;\nuse App\\Mail\\WelcomeEmail;\n\nMail::to('user@example.com')-\u003esend(new WelcomeEmail($user));\n```\n\n### HTML Emails with Attachments\n\n```php\nuse Illuminate\\Support\\Facades\\Mail;\n\nMail::send('emails.welcome', ['user' =\u003e $user], function ($message) use ($user) {\n    $message-\u003eto($user-\u003eemail)\n            -\u003esubject('Welcome!')\n            -\u003eattach('/path/to/file.pdf');\n});\n```\n\n## Token Caching Issues\n\nAccess tokens are cached for 55 minutes by default. If you need to clear the cache:\n\n```php\napp('mail.microsoft-graph.token-provider')-\u003eclearToken();\n```\n\n## Features\n\n- **OAuth2 Authentication**: Uses client credentials flow for secure authentication\n- **Automatic Token Caching**: Access tokens are cached for 55 minutes\n- **Retry Logic**: Automatic retry on transient failures with attempts and delays\n- **Full Email Support**:\n  - HTML and plain text emails\n  - File attachments (including inline images)\n  - Multiple recipients (To, CC, BCC)\n  - Reply-To headers\n- **Laravel Integration**: Works seamlessly with Laravel's Mail facade, Mailables, and Notifications\n\n## Testing\n\n```bash\ncomposer test\n```\n\n## Changelog\n\nPlease see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.\n\n## Contributing\n\nPlease see [CONTRIBUTING](CONTRIBUTING.md) for details.\n\n## Security Vulnerabilities\n\nPlease review [our security policy](../../security/policy) on how to report security vulnerabilities.\n\n## Credits\n\n- [Enrico De Lazzari](https://github.com/enricodelazzari)\n- [All Contributors](../../contributors)\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaize-tech%2Flaravel-msgraph-mailer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmaize-tech%2Flaravel-msgraph-mailer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaize-tech%2Flaravel-msgraph-mailer/lists"}