PHP code example of innoge / laravel-msgraph-mail
1. Go to this page and download the library: Download innoge/laravel-msgraph-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/ */
innoge / laravel-msgraph-mail example snippets
'microsoft-graph' => [
'transport' => 'microsoft-graph',
'client_id' => env('MICROSOFT_GRAPH_CLIENT_ID'),
'client_secret' => env('MICROSOFT_GRAPH_CLIENT_SECRET'),
'tenant_id' => env('MICROSOFT_GRAPH_TENANT_ID'),
'from' => [
'address' => env('MAIL_FROM_ADDRESS'),
'name' => env('MAIL_FROM_NAME'),
],
'save_to_sent_items' => env('MAIL_SAVE_TO_SENT_ITEMS', false),
],
'microsoft-graph' => [
'transport' => 'microsoft-graph',
'client_id' => env('MICROSOFT_GRAPH_CLIENT_ID'),
'tenant_id' => env('MICROSOFT_GRAPH_TENANT_ID'),
'client_certificate' => [
'certificate' => env('MICROSOFT_GRAPH_CERTIFICATE'), // PEM content or file path
'private_key' => env('MICROSOFT_GRAPH_PRIVATE_KEY'), // PEM content or file path
'passphrase' => env('MICROSOFT_GRAPH_KEY_PASSPHRASE'), // optional
],
// ...
],
use Symfony\Component\Mailer\Header\MetadataHeader;
use Symfony\Component\Mime\Email;
$mailable->withSymfonyMessage(function (Email $message) {
$message->getHeaders()->add(new MetadataHeader('save-to-sent-items', 'true'));
});