PHPackages                             lacodix/laravel-scoped-mail-config - 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. lacodix/laravel-scoped-mail-config

ActiveLaravel-package[Mail &amp; Notifications](/categories/mail)

lacodix/laravel-scoped-mail-config
==================================

A package that enables user or tenant specific mail driver configuration.

v1.3.0(3w ago)12.1k↓54.9%MITPHPPHP ^8.2CI passing

Since Mar 7Pushed 3w ago2 watchersCompare

[ Source](https://github.com/lacodix/laravel-scoped-mail-config)[ Packagist](https://packagist.org/packages/lacodix/laravel-scoped-mail-config)[ Docs](https://github.com/lacodix/laravel-scoped-mail-config)[ GitHub Sponsors](https://github.com/lacodix)[ RSS](/packages/lacodix-laravel-scoped-mail-config/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (7)Dependencies (28)Versions (13)Used By (0)

laravel-scoped-mail-config
==========================

[](#laravel-scoped-mail-config)

[![Latest Version on Packagist](https://camo.githubusercontent.com/392730a78e54e9065b52b8c68f8ba66c7664f4e690f8f4e65e23154f6bb7c24a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6c61636f6469782f6c61726176656c2d73636f7065642d6d61696c2d636f6e6669672e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/lacodix/laravel-scoped-mail-config)[![GitHub Tests Action Status](https://camo.githubusercontent.com/ce41bd7a8738440fc6009bcdbf4534fc42142b50bfba5e34f7174335a020876a/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6c61636f6469782f6c61726176656c2d73636f7065642d6d61696c2d636f6e6669672f746573742e79616d6c3f6272616e63683d6d6173746572266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/lacodix/laravel-scoped-mail-config/actions?query=workflow%3Atest+branch%3Amaster)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/ef1249056478f7d92f13b069a604fc00d52ff6eeab1309cf91be0aba4e774801/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6c61636f6469782f6c61726176656c2d73636f7065642d6d61696c2d636f6e6669672f7374796c652e79616d6c3f6272616e63683d6d6173746572266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/lacodix/laravel-scoped-mail-config/actions?query=workflow%3Astyle+branch%3Amaster)[![Total Downloads](https://camo.githubusercontent.com/b5c3672ebee3ed884cba0012959ec9d2e3ff4adec79a52d3196bb3ac2d70ea5a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6c61636f6469782f6c61726176656c2d73636f7065642d6d61696c2d636f6e6669672e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/lacodix/laravel-scoped-mail-config)

This package makes it an ease to send mails with dynamic mail configuration. The mail configuration can be provided by any model or class, that implements our HasMailConfig Interface.

With this in mind it is the perfect fit for multi tenancy packages like [Laravel-multitenancy](https://github.com/spatie/laravel-multitenancy) by spatie.

It also offers the possibility to keep mail configs in user or team models or even if you just want to be able to offer your admin-user to set a dynamic mail configuration.

Documentation
-------------

[](#documentation)

You can find the entire documentation for this package on [our documentation site](https://www.lacodix.de/docs/laravel-scoped-mail-config)

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

[](#installation)

```
composer require lacodix/laravel-scoped-mail-config
```

Basic Usage
-----------

[](#basic-usage)

Just add our interface to your scope model

```
use Illuminate\Database\Eloquent\Model;
use Lacodix\LaravelScopedMailConfig\Concerns\HasMailConfig;

class Tenant extends Model implements HasMailConfig
{
    public function getMailConfig($name): array {
        return [
            'transport' => 'smtp',
            'host' => 'my.smtp.server',
            'port' => 587,
            'encryption' => null,
            'username' => 'my@email.login',
            'password' => 'mypassword',
            'timeout' => 60,
            'local_domain' => null,
            'from' => [
                'address' => 'my@email.login',
                'name' => 'myname',
            ],
        ];
    }
}
```

In your AppServiceProvider you now just need to inform the package how it shall resolve the mail configuration. By default the Package resolves the current authenticated user. So if you want to use user specific mail configuration then just skip this step.

```
use Lacodix\LaravelScopedMailConfig\Facades\ScopedMail;

public function register(): void
{
    ScopedMail::resolveScopeUsing(fn () => Tenant::getCurrentTenant());
}

```

Then you can send mails with this dynamic configuration just by using our facade like laravel Mail facade:

```
ScopedMail::to('my@email.de')->send($mailable);

```

ScopedMail is just extending standard Mail facade, so there are all functionalities, that you already know from laravel [Mail](https://laravel.com/docs/mail)

Finally it is also possible to use this facade in tests

```
ScopedMail::fake();

```

Testing
-------

[](#testing)

```
composer test
```

Contributing
------------

[](#contributing)

Please run the following commands and solve potential problems before committing and think about adding tests for new functionality.

```
composer rector:test
composer insights
composer csfixer:test
composer phpstan:test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Credits
-------

[](#credits)

- [lacodix](https://github.com/lacodix)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

50

—

FairBetter than 95% of packages

Maintenance94

Actively maintained with recent releases

Popularity23

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity61

Established project with proven stability

 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 ~137 days

Recently: every ~206 days

Total

7

Last Release

25d ago

Major Versions

v0.3.0 → v1.0.02024-03-08

PHP version history (2 changes)v0.1.0PHP ^8.1

v1.3.0PHP ^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/123ffce0596acef2904868164413bca95eeeaa4e2ba557b3620f11fce22cfbb7?d=identicon)[lacodix](/maintainers/lacodix)

---

Top Contributors

[![renky](https://avatars.githubusercontent.com/u/6528960?v=4)](https://github.com/renky "renky (8 commits)")

---

Tags

configurationlaravellaravel-packagemaillaravelconfigmaildynamictenantscopelacodix

###  Code Quality

TestsPest

Static AnalysisPHPStan, Rector

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/lacodix-laravel-scoped-mail-config/health.svg)

```
[![Health](https://phpackages.com/badges/lacodix-laravel-scoped-mail-config/health.svg)](https://phpackages.com/packages/lacodix-laravel-scoped-mail-config)
```

###  Alternatives

[spatie/laravel-permission

Permission handling for Laravel 12 and up

12.9k102.4M1.4k](/packages/spatie-laravel-permission)[spatie/laravel-pdf

Create PDFs in Laravel apps

1.0k4.8M47](/packages/spatie-laravel-pdf)[dedoc/scramble

Automatic generation of API documentation for Laravel applications.

2.1k11.2M101](/packages/dedoc-scramble)[vormkracht10/laravel-mails

Laravel Mails can collect everything you might want to track about the mails that has been sent by your Laravel app.

24857.5k](/packages/vormkracht10-laravel-mails)[propaganistas/laravel-disposable-email

Disposable email validator

6023.0M7](/packages/propaganistas-laravel-disposable-email)[spatie/laravel-passkeys

Use passkeys in your Laravel app

471890.7k39](/packages/spatie-laravel-passkeys)

PHPackages © 2026

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