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.2.0(1y ago)11.1k↓43.8%MITPHPPHP ^8.1CI passing

Since Mar 7Pushed 1y 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 1mo ago

READMEChangelog (6)Dependencies (14)Versions (11)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

37

—

LowBetter than 83% of packages

Maintenance50

Moderate activity, may be stable

Popularity20

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

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

Recently: every ~107 days

Total

6

Last Release

365d ago

Major Versions

v0.3.0 → v1.0.02024-03-08

### 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 (7 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

[propaganistas/laravel-disposable-email

Disposable email validator

5762.6M6](/packages/propaganistas-laravel-disposable-email)[vormkracht10/laravel-mails

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

24149.7k](/packages/vormkracht10-laravel-mails)[xammie/mailbook

Laravel Mail Explorer

482458.3k1](/packages/xammie-mailbook)[spatie/laravel-notification-log

Log notifications sent by your Laravel app

207902.8k](/packages/spatie-laravel-notification-log)[wnx/laravel-sends

Keep track of outgoing emails in your Laravel application.

200427.3k](/packages/wnx-laravel-sends)[spatie/laravel-discord-alerts

Send a message to Discord

151408.0k](/packages/spatie-laravel-discord-alerts)

PHPackages © 2026

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