Download the PHP package ezstoritve/m365-mail without Composer
On this page you can find all versions of the php package ezstoritve/m365-mail. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download ezstoritve/m365-mail
More information about ezstoritve/m365-mail
Files in ezstoritve/m365-mail
Package m365-mail
Short Description Laravel M365 Mail Package using the MSGraph API
License MIT
Homepage https://github.com/ezstoritve/m365-mail
Informations about the package m365-mail
Laravel M365 Mail Package
This package provides seamless access to Microsoft M365 mail functions, allowing you to integrate email handling within your Laravel application effortlessly. It supports sending and reading emails using the Microsoft Graph API, making it easy to work with M365 mailboxes directly from your code. With this package, you can leverage features like sending, fetching emails and downloading attachments, all while securely managing authentication through your Microsoft Azure App credentials.
Installation
You can install the package via composer:
Configuration
Register and configure the Microsoft Azure App
Quickstart: Register an application with the Microsoft identity platform
Configuring your Laravel app
To integrate the m365-mail driver, begin by adding a new entry to the mailers array in your config/mail.php configuration file:
This entry configures the m365-mail transport and sets the required credentials and sender information.
Next, configure the following variables in your .env file to use the credentials from your Microsoft Azure App:
These variables will be used to authenticate and send emails through the Microsoft Graph API, ensuring your Laravel application is properly connected to your Azure setup.
Usage
The Mail::send method and the $m object in the callback accept all standard Laravel parameters, including:
- To, Cc, Bcc: Specify recipients.
- Subject: Set the email subject.
- From: Define the sender’s email.
- ReplyTo: Set the reply-to address.
- Attachments: Attach files to the email.
- Body (text or HTML): Compose the email content.
These parameters allow for full customization of email messages within your application.
Sample code:
The Mail::read function accepts the following parameters:
- FolderPath (Inbox\Folder1...): Specifies which folder in the Microsoft 365 mailbox to read from.
- Mailbox (user email): The email address of the user’s mailbox to read.
- GetFiles (true, false): Determines whether to retrieve the attachment contentBytes, allowing manual download.
- Download (true, false): Automatically downloads attachments to the specified folder.
- FilePath (e.g., public_path('temp')): Allows you to set a custom path for downloaded files.
This code can be customized to suit your specific requirements.
Sample code:
The Mail::read method returns an array containing the following fields:
- id: The unique identifier of the email.
- subject: The subject line of the email.
- from: The sender's email address.
- fromName: The sender's display name.
- bodyPreview: A preview of the email body.
- receivedDateTime: The timestamp when the email was received.
- hasAttachments: Boolean indicating if the email has attachments.
- to: An array of recipients, including their addresses and names.
- cc: An array of CC recipients with their addresses and names.
- bcc: An array of BCC recipients with their addresses and names.
- attachments: An array of attachments, each including the filename and contentBytes (if GetFiles is true, allowing manual download).
Changelog
Please see CHANGELOG for more information on what has changed recently.
Credits
License
The MIT License (MIT). Please see License File for more information.
All versions of m365-mail with dependencies
laravel/framework Version ^10.0
spatie/laravel-package-tools Version ^1.14.0
symfony/mailer Version ^6.0|^7.0