PHPackages                             sunaoka/laravel-ses-template-driver - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Mail &amp; Notifications](/categories/mail)
4. /
5. sunaoka/laravel-ses-template-driver

ActiveLibrary[Mail &amp; Notifications](/categories/mail)

sunaoka/laravel-ses-template-driver
===================================

Amazon SES template mail driver for Laravel.

v4.3.0(4mo ago)1093.8k↓47.7%2MITPHPPHP ^8.1CI passing

Since Jan 23Pushed 3w ago3 watchersCompare

[ Source](https://github.com/sunaoka/laravel-ses-template-driver)[ Packagist](https://packagist.org/packages/sunaoka/laravel-ses-template-driver)[ RSS](/packages/sunaoka-laravel-ses-template-driver/feed)WikiDiscussions develop Synced 3d ago

READMEChangelogDependencies (12)Versions (49)Used By (0)

Amazon SES template mail driver for Laravel
===========================================

[](#amazon-ses-template-mail-driver-for-laravel)

[![Latest](https://camo.githubusercontent.com/874e7f9bd6ac38146293dcd645a5963ea133124ab1b471dfdcb287856c399b02/68747470733a2f2f706f7365722e707567782e6f72672f73756e616f6b612f6c61726176656c2d7365732d74656d706c6174652d6472697665722f76)](https://packagist.org/packages/sunaoka/laravel-ses-template-driver)[![License](https://camo.githubusercontent.com/a153416d49dce164baacc406c1affbb43d664b4b24f0cc1b146f22da172afa4c/68747470733a2f2f706f7365722e707567782e6f72672f73756e616f6b612f6c61726176656c2d7365732d74656d706c6174652d6472697665722f6c6963656e7365)](https://packagist.org/packages/sunaoka/laravel-ses-template-driver)[![PHP](https://camo.githubusercontent.com/e0457d3b247ad85a89f561d0c8c05f669f9838d22043030dc89b0516ae532c10/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f73756e616f6b612f6c61726176656c2d7365732d74656d706c6174652d647269766572)](composer.json)[![Laravel](https://camo.githubusercontent.com/590823fca80173af3964ce80d36aacc8ace3f5a397d0842a49737b697bef4cb0/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c61726176656c2d25334525334431302d726564)](https://laravel.com/)[![Test](https://github.com/sunaoka/laravel-ses-template-driver/actions/workflows/test.yml/badge.svg?branch=develop)](https://github.com/sunaoka/laravel-ses-template-driver/actions/workflows/test.yml)[![codecov](https://camo.githubusercontent.com/2714af69a38b83eedde73d7b3cc6ab5ab72a92281f6b28b41c828edd86c0bc07/68747470733a2f2f636f6465636f762e696f2f67682f73756e616f6b612f6c61726176656c2d7365732d74656d706c6174652d6472697665722f6272616e63682f646576656c6f702f67726170682f62616467652e737667)](https://codecov.io/gh/sunaoka/laravel-ses-template-driver)

---

A Mail Driver with support for [Using templates to send personalized emails with the Amazon SES API](https://docs.aws.amazon.com/ses/latest/dg/send-personalized-email-api.html).

Support Policy
--------------

[](#support-policy)

Version (\*1)Laravel (\*2)PHP (\*3)[1](https://github.com//sunaoka/laravel-ses-template-driver/tree/v1.x)5.7 - 67.1 - 7.4[2](https://github.com//sunaoka/laravel-ses-template-driver/tree/v2.x)7 - 87.2 - 8.1[3](https://github.com//sunaoka/laravel-ses-template-driver/tree/v3.x)9 - 118.0 - 8.4410 - 138.1 - 8.5(\*1) Supported Amazon SES template mail driver (This Driver) version

(\*2) Supported Laravel versions

(\*3) Supported PHP versions

Installation
------------

[](#installation)

```
composer require sunaoka/laravel-ses-template-driver
```

Next, set the following in `config/mail.php` and `config/services.php`.

### config/mail.php

[](#configmailphp)

```
'default' => 'sestemplate',

'mailers' => [
    'sestemplate' => [
        'transport' => 'sestemplate',  // or `sesv2template` - When using Amazon SES API v2
    ],
],
```

### config/services.php

[](#configservicesphp)

```
'ses' => [
    'key'    => 'your-ses-key',
    'secret' => 'your-ses-secret',
    'region' => 'ses-region',  // e.g. us-east-1
],
```

If you need to include [additional options](https://docs.aws.amazon.com/aws-sdk-php/v3/api/api-email-2010-12-01.html#sendtemplatedemail) when executing the SES `SendTemplatedEmail` request, you may define an `options` array within your `ses` configuration:

```
'ses' => [
    'key'     => 'your-ses-key',
    'secret'  => 'your-ses-secret',
    'region'  => 'ses-region',  // e.g. us-east-1
    'options' => [
        'ConfigurationSetName' => 'MyConfigurationSet',
        'TenantName'           => 'MyTenant',  // using Amazon SES API v2 with AWS SDK for PHP 3.352.0 or later
        'Tags' => [
            [
                'Name'  => 'foo',
                'Value' => 'bar',
            ],
        ],
    ],
],
```

Basic usage
-----------

[](#basic-usage)

```
use Illuminate\Support\Facades\Mail;
use Sunaoka\LaravelSesTemplateDriver\Mail\SesTemplate;

class Foo
{
    public function sendmail()
    {
        $templateName = 'MyTemplate';
        $templateData = [
            'name' => 'Alejandro',
            'favoriteanimal' => 'alligator',
        ];

        $result = Mail::to('alejandro.rosalez@example.com')
            ->cc('cc@example.com')
            ->bcc('bcc@example.com')
            ->send(new SesTemplate($templateName, $templateData));

        echo $result->getMessageId();  // Message-ID overwritten by Amazon SES
    }
}
```

### Options

[](#options)

Set `From`, `Reply-To` and custom header.

```
use Illuminate\Mail\Mailables\Address;
use Illuminate\Support\Facades\Mail;
use Sunaoka\LaravelSesTemplateDriver\Mail\SesTemplate;
use Sunaoka\LaravelSesTemplateDriver\Mail\SesTemplateOptions;

class Foo
{
    public function sendmail()
    {
        $templateName = 'MyTemplate';
        $templateData = [
            'name' => 'Alejandro',
            'favoriteanimal' => 'alligator',
        ];

        $options = new SesTemplateOptions();
        $options->from(new Address('alejandro.rosalez@example.com', 'Alejandro Rosalez'))
                ->replyTo(new Address('alejandro.rosalez@example.com'));

        // Only with Amazon SES API v2 ('transport' is `sesv2template`)
        $options->header('X-Custom-Header1', 'Custom Value 1')
                ->header('X-Custom-Header2', 'Custom Value 2');

        // You can also set it in the constructor.
        $options = new SesTemplateOptions(
            from: new Address('alejandro.rosalez@example.com', 'Alejandro Rosalez'),
            replyTo: new Address('alejandro.rosalez@example.com'),
            headers: [
                'X-Custom-Header1' => 'Custom Value 1',
                'X-Custom-Header2' => 'Custom Value 2',
            ],
        );

        $result = Mail::to('alejandro.rosalez@example.com')
            ->cc('cc@example.com')
            ->bcc('bcc@example.com')
            ->send(new SesTemplate($templateName, $templateData, $options));

        echo $result->getMessageId();  // Message-ID overwritten by Amazon SES
    }
}
```

### To send a templated email to a single destination

[](#to-send-a-templated-email-to-a-single-destination)

```
{
  "Template": {
    "TemplateName": "MyTemplate",
    "SubjectPart": "Greetings, {{name}}!",
    "HtmlPart": "Hello {{name}},Your favorite animal is {{favoriteanimal}}.",
    "TextPart": "Dear {{name}},\r\nYour favorite animal is {{favoriteanimal}}."
  }
}
```

> Not supported, to send a templated email to multiple destinations.

Artisan Console Commands
------------------------

[](#artisan-console-commands)

### Lists the email templates present in your Amazon SES account in the current AWS Region.

[](#lists-the-email-templates-present-in-your-amazon-ses-account-in-the-current-aws-region)

#### Options

[](#options-1)

```
php artisan ses-template:list-templates --help
```

```
Description:
  Lists the email templates present in your Amazon SES account in the current AWS Region

Usage:
  ses-template:list-templates [options]

Options:
      --name            Sort by the name of the template [default]
      --time            Sort by the time and date the template was created
      --asc             Sort by ascending order [default]
      --desc            Sort by descending order
      --json            The output is formatted as a JSON string

```

#### Output Text format

[](#output-text-format)

```
php artisan ses-template:list-templates
```

```
+----+-------------+---------------------------+
| No | Name        | Created At                |
+----+-------------+---------------------------+
| 0  | MyTemplate  | 2020-11-24T15:01:21+00:00 |
| 1  | MyTemplate2 | 2020-11-24T15:01:25+00:00 |
+----+-------------+---------------------------+

Enter a number to display the template object:
> 0

TemplateName:
MyTemplate

SubjectPart:
Greetings, {{name}}!

TextPart:
Dear {{name}},\r\nYour favorite animal is {{favoriteanimal}}.

HtmlPart:
Hello {{name}},Your favorite animal is {{favoriteanimal}}.

```

#### Output JSON format

[](#output-json-format)

```
php artisan ses-template:list-templates --json
```

```
{
  "TemplatesMetadata": [
    {
      "Name": "MyTemplate",
      "CreatedTimestamp": "2020-11-24T15:01:21+00:00"
    },
    {
      "Name": "MyTemplate2",
      "CreatedTimestamp": "2020-11-24T15:01:25+00:00"
    }
  ]
}
```

Amazon SES API v2

```
{
  "TemplatesMetadata": [
    {
      "TemplateName": "MyTemplate",
      "CreatedTimestamp": "2020-11-24T15:01:21+00:00"
    },
    {
      "TemplateName": "MyTemplate2",
      "CreatedTimestamp": "2020-11-24T15:01:25+00:00"
    }
  ]
}
```

### Displays the template object for the template you specify

[](#displays-the-template-object-for-the-template-you-specify)

#### Options

[](#options-2)

```
php artisan ses-template:get-template --help
```

```
Description:
  Displays the template object for the template you specify

Usage:
  ses-template:get-template [options] [--]

Arguments:
  TemplateName          The name of the template to retrieve

Options:
      --json            The output is formatted as a JSON string

```

#### Output Text format

[](#output-text-format-1)

```
php artisan ses-template:get-template MyTemplate
```

```
TemplateName:
MyTemplate

SubjectPart:
Greetings, {{name}}!

TextPart:
Dear {{name}},\r\nYour favorite animal is {{favoriteanimal}}.

HtmlPart:
Hello {{name}},Your favorite animal is {{favoriteanimal}}.

```

#### Output JSON format

[](#output-json-format-1)

```
php artisan ses-template:get-template MyTemplate --json
```

```
{
  "Template": {
    "TemplateName": "MyTemplate",
    "SubjectPart": "Greetings, {{name}}!",
    "HtmlPart": "Hello {{name}},Your favorite animal is {{favoriteanimal}}.",
    "TextPart": "Dear {{name}},\r\nYour favorite animal is {{favoriteanimal}}."
  }
}
```

Amazon SES API v2

```
{
  "Template": {
    "TemplateName": "MyTemplate",
    "TemplateContent": {
      "Subject": "Greetings, {{name}}!",
      "Html": "Hello {{name}},Your favorite animal is {{favoriteanimal}}.",
      "Text": "Dear {{name}},\r\nYour favorite animal is {{favoriteanimal}}."
    }
  }
}
```

AWS Identity and Access Management (IAM) Policy
-----------------------------------------------

[](#aws-identity-and-access-management-iam-policy)

### Amazon SES API (v1)

[](#amazon-ses-api-v1)

```
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "ses:SendTemplatedEmail",
        "ses:ListTemplates",
        "ses:GetTemplate"
      ],
      "Resource": "*"
    }
  ]
}
```

### Amazon SES API v2

[](#amazon-ses-api-v2)

```
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "ses:SendEmail",
        "ses:ListEmailTemplates",
        "ses:GetEmailTemplate"
      ],
      "Resource": "*"
    }
  ]
}
```

Reference
---------

[](#reference)

- [Mail - Laravel - The PHP Framework For Web Artisans](https://laravel.com/docs/master/mail)
- [Using templates to send personalized emails with the Amazon SES API](https://docs.aws.amazon.com/ses/latest/dg/send-personalized-email-api.html)
- [Class Aws\\Ses\\SesClient | AWS SDK for PHP 3.x](https://docs.aws.amazon.com/aws-sdk-php/v3/api/class-Aws.Ses.SesClient.html)
- [Class Aws\\SesV2\\SesV2Client | AWS SDK for PHP 3.x](https://docs.aws.amazon.com/aws-sdk-php/v3/api/class-Aws.SesV2.SesV2Client.html)

###  Health Score

60

—

FairBetter than 98% of packages

Maintenance87

Actively maintained with recent releases

Popularity38

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity83

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~57 days

Recently: every ~19 days

Total

46

Last Release

123d ago

Major Versions

v2.2.0 → v3.1.02022-12-12

v3.4.0 → v4.0.02024-04-02

v1.x-dev → v2.x-dev2025-12-19

v2.2.1 → v3.x-dev2025-12-19

v3.4.1 → v4.2.22025-12-19

PHP version history (5 changes)v0.0.1PHP ^7.1.3

v2.0.0PHP ^7.2.5

v2.0.3PHP ^7.2.5 || ^8.0

v3.0.0PHP ^8.0

v4.0.0PHP ^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/aab0eef8c17cb4a1d856c457224642bdf29adf5255e2f9db84e1c192f78ef272?d=identicon)[sunaoka](/maintainers/sunaoka)

---

Top Contributors

[![sunaoka](https://avatars.githubusercontent.com/u/105845?v=4)](https://github.com/sunaoka "sunaoka (176 commits)")

---

Tags

amazon-sesaws-seslaravellaravel-packagelaravel10laravel11laravel5laravel6laravel7laravel8laravel9mail-driverphpphp7php8php81php82seslaravelawsmaildriversessesv2

###  Code Quality

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/sunaoka-laravel-ses-template-driver/health.svg)

```
[![Health](https://phpackages.com/badges/sunaoka-laravel-ses-template-driver/health.svg)](https://phpackages.com/packages/sunaoka-laravel-ses-template-driver)
```

###  Alternatives

[laravel/ai

The official AI SDK for Laravel.

1.0k3.2M200](/packages/laravel-ai)[propaganistas/laravel-disposable-email

Disposable email validator

6023.0M7](/packages/propaganistas-laravel-disposable-email)[laravel-notification-channels/discord

Laravel notification driver for Discord.

2401.4M17](/packages/laravel-notification-channels-discord)[juhasev/laravel-ses

Allows you to track opens, deliveries, bounces, complaints and clicked links when sending emails through Laravel and Amazon SES

1710.3k](/packages/juhasev-laravel-ses)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
