Provides Azure Communication Service integration for Symfony Mailer / Laravel.
- PHP 8.2 or higher.
- Laravel 10.x or higher.
- Azure account, Azure CS Access Key and Service Endpoint.
First time using Azure ECS? Create your Azure account, if you don’t have one already.
-
Download Composer if not already installed
-
On your project directory run on the command line
composer require jliglesias/laravel-azure-mailer
-
Get your Azure CS Access Key and Service Endpoint.
Add entry to [root-of-laravel]/config/mail.php:
<?php
...
'mailers' => [
//...other drivers
'azure' => [
'transport' => 'azure',
'resource_name' => env('AZURE_MAIL_RESOURCE_NAME'),
'endpoint' => env('AZURE_MAIL_ENDPOINT', 'https://my-acs-resource-name.communication.azure.com'),
'access_key' => env('AZURE_MAIL_KEY'),
'api_version' => env('AZURE_MAIL_API_VERSION', '2023-03-31'),
'disable_user_tracking' => env('AZURE_MAIL_DISABLE_TRACKING', false),
],
]
?>
Add entry to [root-of-laravel]/.env:
#...other entries
# Mail service entries...
MAIL_MAILER=azure
# Azure Service entries
AZURE_MAIL_RESOURCE_NAME=my-acs-resource-name
# AZURE_MAIL_ENDPOINT= #optional
AZURE_MAIL_KEY=AzureAccessToken
# AZURE_MAIL_API_VERSION=2023-03-31 #optional
# AZURE_MAIL_DISABLE_TRACKING=false #optional
Build powerful, cloud-based communication and customer engagement experiences by adding email integration with Azure Communication Service to your apps.
- Azure Communication Service Docs: English
- Prepare Email Communication resource for Azure Communication Service Docs: English
- Sending mail with Laravel (10x): English
Simple mail sending:
Mail::to($request->user())
->cc($moreUsers)
->bcc($evenMoreUsers)
->send(new OrderShipped($order));
or
Mail::to([new Address('[email protected]', 'My User Name'), ...])
->cc([new Address('[email protected]', 'My User Name'), ...])
->bcc([new Address('[email protected]', 'My User Name'), ...])
->send('my.view');
Sending mail with attachments:
$data = [
to => [new Address('[email protected]', 'My User Name'), ...],
subject => 'Subject'
];
$files = [
public_path('files/160031367318.pdf'),
public_path('files/1599882252.png'),
];
Mail::send('my.view', $data, function($message)use($data, $files) {
$message->to($data["to"])
->subject($data["subject"]);
foreach ($files as $file){
$message->attach($file);
}
});
If you need more information, read the Laravel (10x) documentation: English
** 0.1.0-beta.1
- Main release.
- Remove folders and files for testing event dispatch and callbacks using AJAX (JQUERY).
MIT license. Copyright (c) 2024 - Juan Luis Iglesias For more information, see the LICENSE file.