Skip to content

Provides Azure Communication Service integration for Symfony Mailer / Laravel.

License

Notifications You must be signed in to change notification settings

hogendoorn/laravel-azure-mailer

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

83 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Microsoft Azure Mailer Driver for Laravel

Provides Azure Communication Service integration for Symfony Mailer / Laravel.

Requirements

Installation

First time using Azure ECS? Create your Azure account, if you don’t have one already.

  1. Download Composer if not already installed

  2. On your project directory run on the command line composer require jliglesias/laravel-azure-mailer

  3. Get your Azure CS Access Key and Service Endpoint.

Configuration

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
  

Documentation

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

Examples

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

Last change

** 0.1.0-beta.1

  • Main release.

** 0.1.1.-beta.1

  • Remove folders and files for testing event dispatch and callbacks using AJAX (JQUERY).

License

MIT license. Copyright (c) 2024 - Juan Luis Iglesias For more information, see the LICENSE file.

About

Provides Azure Communication Service integration for Symfony Mailer / Laravel.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 100.0%