PHPackages                             mindtwo/px-mail-laravel-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. [Framework](/categories/framework)
4. /
5. mindtwo/px-mail-laravel-driver

ActiveProprietary[Framework](/categories/framework)

mindtwo/px-mail-laravel-driver
==============================

A project to integrate TX Mail as mail service in Laravel.

1.1.0(2mo ago)09MITPHPPHP ^8.4

Since Dec 22Pushed 2mo ago5 watchersCompare

[ Source](https://github.com/mindtwo/px-mail-laravel-driver)[ Packagist](https://packagist.org/packages/mindtwo/px-mail-laravel-driver)[ RSS](/packages/mindtwo-px-mail-laravel-driver/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (15)Versions (24)Used By (0)

PX-Mail Laravel Driver
======================

[](#px-mail-laravel-driver)

[![Latest Version on Packagist](https://camo.githubusercontent.com/877d724684c45253c0c6d4725beeca2edd960390b29abcd366bd52c2524ba2b9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d696e6474776f2f70782d6d61696c2d6c61726176656c2d6472697665722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/mindtwo/px-mail-laravel-driver)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Total Downloads](https://camo.githubusercontent.com/66c4118f461d30d5e438981e63654f92fb486c37b7df7e20702abdb501089274/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d696e6474776f2f70782d6d61696c2d6c61726176656c2d6472697665722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/mindtwo/px-mail-laravel-driver)

A Laravel mail driver for the PX Mail (TX Mail) API.

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

[](#installation)

```
composer require mindtwo/px-mail-laravel-driver
```

Configuration
-------------

[](#configuration)

### Publish the config file

[](#publish-the-config-file)

```
php artisan vendor:publish --tag=px-mail
```

This publishes `config/px-mail.php`. This step is optional if you configure everything via environment variables.

### Environment variables

[](#environment-variables)

Add the following to your `.env` file:

```
TX_MAIL_URL=https://tx-mail.api.pl-x.cloud
TX_MAIL_TENANT=your-tenant
TX_MAIL_CLIENT_ID=your-client-id
TX_MAIL_CLIENT_SECRET=your-client-secret
```

### Register the mailer

[](#register-the-mailer)

Add the transport to the `mailers` section in `config/mail.php`:

```
'mailers' => [
    'txmail' => [
        'transport' => 'txmail',
    ],
],
```

Then set it as your default mailer in `.env`:

```
MAIL_MAILER=txmail
```

Config reference
----------------

[](#config-reference)

KeyEnv variableDefaultDescription`stage``APP_ENV``APP_ENV`The application stage. `local` is mapped to `preprod` automatically.`mailer_url``TX_MAIL_URL`—Base URL of the TX Mail API.`mailer_api_version``TX_MAIL_API_VERSION``v1`API version appended to the base URL.`tenant``TX_MAIL_TENANT`—Your TX Mail tenant identifier used in the API path.`client_id``TX_MAIL_CLIENT_ID`—Client ID for M2M authentication.`client_secret``TX_MAIL_CLIENT_SECRET`—Client secret for M2M authentication.`debug``TX_MAIL_DEBUG``false`When `true`, enables HTTP-level request/response logging for all API calls.`log_send``TX_MAIL_LOG_SEND``false`When `true`, logs each outgoing send attempt (sender, recipient, tenant, URL). Can be enabled independently of `debug`.`headers`—`[]`Additional headers merged into every request. See [Additional headers](#additional-headers).Usage
-----

[](#usage)

Once configured, use Laravel's `Mail` facade as normal:

```
Mail::to($user)->send(new OrderConfirmation($order));
```

Context headers
---------------

[](#context-headers)

The driver supports optional `x-context-tenant-code` and `x-context-domain-code` headers. These are useful in multi-tenant applications where the sending context needs to be forwarded to the mail API.

Set them on the `ApiClient` via the service container's `resolving` callback, typically inside a service provider:

```
use mindtwo\LaravelPxMail\Client\ApiClient;

$this->app->resolving(ApiClient::class, function (ApiClient $client) {
    $client->setContextTenant(tenant()->code);
    $client->setContextDomain(domain()->code);
});
```

The callbacks are resolved fresh on every `ApiClient` instantiation, so the values are always up to date.

You can also set them directly on the resolved instance at any point before sending:

```
app(ApiClient::class)
    ->setContextTenant('acme')
    ->setContextDomain('shop');
```

Additional headers
------------------

[](#additional-headers)

Static additional headers can be defined in the config:

```
// config/px-mail.php
'headers' => [
    'X-Custom-Header' => 'value',
],
```

They can also be set at runtime, for example in middleware:

```
config(['px-mail.headers' => ['X-Custom-Header' => 'value']]);
```

Logging
-------

[](#logging)

### Send logging

[](#send-logging)

Enable send logging to record every outgoing mail attempt:

```
TX_MAIL_LOG_SEND=true
```

Logs the tenant, client ID, API URL, sender address, and anonymized recipient (e.g. `j***@example.com`) before each send. All entries are prefixed with `[px-mail]`.

### Debug mode

[](#debug-mode)

Enable debug mode for HTTP-level logging:

```
TX_MAIL_DEBUG=true
```

Logs the full request and response details for every API call. Errors (4xx/5xx) are always logged regardless of this setting.

Both options can be combined or used independently.

Changelog
---------

[](#changelog)

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

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

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

### Security

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [mindtwo GmbH](https://github.com/mindtwo)
- [All Other Contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

47

—

FairBetter than 94% of packages

Maintenance87

Actively maintained with recent releases

Popularity4

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity73

Established project with proven stability

 Bus Factor1

Top contributor holds 94.1% 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 ~61 days

Recently: every ~52 days

Total

20

Last Release

64d ago

Major Versions

0.7.2 → 1.0.02026-02-09

PHP version history (5 changes)0.2.2PHP ^8.0

0.3PHP ^8.0|^8.1

0.4.2PHP ^8.0|^8.1|^8.2

0.5.0PHP ^8.0|^8.1|^8.2|^8.3|^8.4

1.0.0PHP ^8.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/4cc86fe6179314d204b14d1c81eb09a87ef84b0bcf2360dcd981171d1346c077?d=identicon)[mindtwo](/maintainers/mindtwo)

---

Top Contributors

[![blumewas](https://avatars.githubusercontent.com/u/5960093?v=4)](https://github.com/blumewas "blumewas (32 commits)")[![jonasemde](https://avatars.githubusercontent.com/u/5083193?v=4)](https://github.com/jonasemde "jonasemde (2 commits)")

---

Tags

frameworklaravel

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/mindtwo-px-mail-laravel-driver/health.svg)

```
[![Health](https://phpackages.com/badges/mindtwo-px-mail-laravel-driver/health.svg)](https://phpackages.com/packages/mindtwo-px-mail-laravel-driver)
```

###  Alternatives

[codewithdennis/larament

Larament is a time-saving starter kit to quickly launch Laravel 13.x projects. It includes FilamentPHP 5.x pre-installed and configured, along with additional tools and features to streamline your development workflow.

3691.5k](/packages/codewithdennis-larament)[kompo/kompo

Laravel &amp; Vue.js FullStack Components for Rapid Application Development

11812.4k21](/packages/kompo-kompo)

PHPackages © 2026

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