PHP code example of delaneydev / microsoftgraph-365-mail
1. Go to this page and download the library: Download delaneydev/microsoftgraph-365-mail library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
delaneydev / microsoftgraph-365-mail example snippets
use App\Models\MicrosoftGraphAccessToken;
use LLoadout\Microsoftgraph\EventListeners\MicrosoftGraphCallbackReceived;
public function boot()
{
Event::listen(function (MicrosoftGraphCallbackReceived $event) {
session()->put('microsoftgraph-access-data', $event->accessData);
});
}
// Mailable
Mail::to('[email protected]')->send(new \App\Mail\MyMailable());
// Quick test
Mail::raw('Hello from Microsoft Graph', function ($message) {
$message->to('[email protected]')->subject('Graph Test');
});