PHPackages                             phpsoftbox/mailer - 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. phpsoftbox/mailer

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

phpsoftbox/mailer
=================

SMTP mailer for the PhpSoftBox framework

031PHP

Since Jul 8Pushed 1mo agoCompare

[ Source](https://github.com/phpsoftbox/mailer)[ Packagist](https://packagist.org/packages/phpsoftbox/mailer)[ RSS](/packages/phpsoftbox-mailer/feed)WikiDiscussions master Synced 1w ago

READMEChangelogDependenciesVersions (1)Used By (0)

Mailer (SMTP)
=============

[](#mailer-smtp)

SMTP-отправка для PhpSoftBox, совместимая с компонентом Notifications.

Быстрый старт
-------------

[](#быстрый-старт)

```
use PhpSoftBox\Mailer\Smtp\SmtpClient;
use PhpSoftBox\Mailer\Smtp\SmtpClientConfig;
use PhpSoftBox\Mailer\Transport\SmtpEmailTransport;
use PhpSoftBox\Mailer\Transport\FileEmailTransport;
use PhpSoftBox\Notifications\Email\EmailChannel;

$config = new SmtpClientConfig(
    host: 'mailhog',
    port: 1025,
    username: null,
    password: null,
    encryption: 'none',
    helo: 'domain.local',
);

$transport = new SmtpEmailTransport(
    new SmtpClient($config),
    defaultFrom: 'no-reply@domain.local',
    defaultFromName: 'CHGS WMS',
);
$channel = new EmailChannel($transport, /* markdown */ null, /* renderer */ null, 'CHGS WMS ');
```

`defaultFrom` и payload `from` могут быть как чистым mailbox-адресом, так и адресом вида `CHGS WMS `. SMTP envelope `MAIL FROM` всегда получает только mailbox-часть. Если транспорт используется без `EmailChannel`, отображаемое имя можно задать отдельно через `defaultFromName`.

File transport
--------------

[](#file-transport)

Для локальной отладки можно сохранять письма в файлы:

```
$transport = new FileEmailTransport(
    __DIR__ . '/var/mails',
    defaultFrom: 'no-reply@domain.local',
    defaultFromName: 'CHGS WMS',
);
```

MailHog
-------

[](#mailhog)

Для локальной отладки удобно использовать MailHog (SMTP + UI). Сервис можно поднять через `docker-compose`:

```
mailhog:
  image: mailhog/mailhog
  ports:
    - "1025:1025"
    - "8025:8025"
```

UI доступен на `http://localhost:8025`.

EmailMessage layout
-------------------

[](#emailmessage-layout)

Для шаблонных email используйте `template()` и `layout()`:

```
use PhpSoftBox\Mailer\Message\EmailMessage;

$message = EmailMessage::create('Тема письма')
    ->template('email/content.phtml', ['name' => 'User'])
    ->layout('email/layout.phtml', ['title' => 'Тема письма']);
```

В `template()`/`layout()` можно передавать как массив, так и DTO-объект.

###  Health Score

22

—

LowBetter than 21% of packages

Maintenance61

Regular maintenance activity

Popularity7

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity11

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/0279d150240c97d210034878b0467462246dc14d29b5618157ff6a8be49a50e3?d=identicon)[inspector-who](/maintainers/inspector-who)

---

Top Contributors

[![inspector-who](https://avatars.githubusercontent.com/u/6973963?v=4)](https://github.com/inspector-who "inspector-who (1 commits)")

### Embed Badge

![Health badge](/badges/phpsoftbox-mailer/health.svg)

```
[![Health](https://phpackages.com/badges/phpsoftbox-mailer/health.svg)](https://phpackages.com/packages/phpsoftbox-mailer)
```

###  Alternatives

[bigbharatjain/laravel-clickatell

This package makes it easy to send sms using clickatell.com with Laravel 5.

1435.2k](/packages/bigbharatjain-laravel-clickatell)[motomedialab/smtp2go

Send emails via API using the first-class email courier SMTP2Go

1323.6k](/packages/motomedialab-smtp2go)

PHPackages © 2026

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