PHPackages                             rutrue/laravel-sendsay - 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. rutrue/laravel-sendsay

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

rutrue/laravel-sendsay
======================

Пакет для работы с транзакционными письмами через sendsay.ru (Laravel)

01PHP

Since Jun 16Pushed 11mo agoCompare

[ Source](https://github.com/lacoste-sochi/sendsay-laravel)[ Packagist](https://packagist.org/packages/rutrue/laravel-sendsay)[ RSS](/packages/rutrue-laravel-sendsay/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Laravel Sendsay Package
=======================

[](#laravel-sendsay-package)

Пакет для работы с транзакционными письмами через API sendsay.ru

Установка
---------

[](#установка)

```
composer require rutrue/laravel-sendsay
```

Публикация конфига:

```
php artisan vendor:publish --provider="Rutrue\Sendsay\SendsayServiceProvider" --tag="config"
```

Конфигурация (.env)
-------------------

[](#конфигурация-env)

```
SENDSAY_DEFAULT_FROM=noreply@example.com
SENDSAY_ACCOUNT=your_account
SENDSAY_API_KEY=your_api_key
```

Использование
-------------

[](#использование)

### Базовый пример

[](#базовый-пример)

```
use Rutrue\Sendsay\Facades\Sendsay;

Sendsay::sendTransactionalMail([
    'to' => 'client@example.com', // Кому
    'subject' => "Сервис ООО 'Рога и Копыта'", // Тема письма

    'text' => 'Спасибо за заказ! Номер: 12345' // Текст письма
    // или
    'html' => 'Спасибо за заказ!Номер: 12345', // Текст письма HTML
]);
```

### Использование шаблонов

[](#использование-шаблонов)

```
Sendsay::sendTransactionalMail([
    'to' => 'client@example.com', // Кому
    'draft_id' => '123', // ID шаблона, легко можно узнать из ЛК, в ссылке на странице шаблоне будет его ID
    'extra' => [ // Переменные и их значения, в шаблоне переменные размещаются в тексте так: Моя переменная в шаблоне - [% foo %]
        'name' => 'Иванов Иван',
        'order_id' => '456'
    ]
]);
```

### Отправка с вложениями

[](#отправка-с-вложениями)

```
Sendsay::sendTransactionalMail([
    'to' => 'client@example.com',
    'subject' => 'Documents',
    'attaches' => [
        [    // локальные файлы
            'name' => 'Document.pdf', // необязательно, без указание файла будет название файла оригинальное
            'path' => storage_path('app/documents/file.pdf')
        ],
        [   // ссылки на файлы которые необходимо прикрепить к письму
            'url' => 'https://example.com/report.pdf'
        ]
    ]
]);
```

### Внедрение зависимости сервиса

[](#внедрение-зависимости-сервиса)

```
use Rutrue\Sendsay\Contracts\SendsayServiceInterface;

class OrderController
{
    public function sendReceipt(SendsayServiceInterface $sendsay)
    {
        $sendsay->sendTransactionalMail([...]);
    }
}
```

Интеграция с Laravel Notifications
----------------------------------

[](#интеграция-с-laravel-notifications)

Создайте канал уведомлений:

```
namespace App\Notifications;

use Illuminate\Notifications\Notification;
use Rutrue\Sendsay\Messages\SendsayMessage;

class InvoicePaid extends Notification
{
    public function via($notifiable)
    {
        return ['sendsay'];
    }

    public function toSendsay($notifiable)
    {
        return (new SendsayMessage)
            ->subject('Счет оплачен')
            ->html("Заказ #{$this->orderId} оплачен!")
            ->from('billing@example.com')
            ->attaches([
                ['path' => storage_path('app/invoices/invoice.pdf')]
            ]);
    }
}
```

Отправка уведомления:

```
$user->notify(new InvoicePaid($orderId));

// Или для нескольких пользователей
Notification::send($users, new InvoicePaid($orderId));
```

Рекомендации для Production
---------------------------

[](#рекомендации-для-production)

1. Обрабатывайте ошибки:

```
try {
    Sendsay::sendTransactionalMail([...]);
} catch (\Rutrue\Sendsay\Exceptions\SendsayException $e) {
    // Логирование ошибки
}
```

### Методы контроллера которые успешно прошли испытания в тестовой среде

[](#методы-контроллера-которые-успешно-прошли-испытания-в-тестовой-среде)

```
class TestSendayController extends Controller
{
    public function sendEmail()
    {
        // Только текст
        //return Sendsay::sendTransactionalMail([
        //    'to' => 'info@rutrue.ru',
        //    'subject' => 'Ваш заказ принят',
        //    'text' => 'Спасибо за заказ №12345',
        //    'attaches' => [
        //        [
        //            'name' => 'Мой файл.pdf', // необязательно, без указание файла будет название файла оригинальное
        //            'path' => storage_path('app/public/file.pdf') // Путь в storage
        //        ],
        //        [
        //            'url' => 'https://t3.ftcdn.net/jpg/03/06/48/88/360_F_306488873_EA34BzCGxmTmn3DRhDcrYiani5Vp8vSD.jpg',
        //        ]
        //    ]
        //]);

        // HTML-письмо
        //return Sendsay::sendTransactionalMail([
        //    'from' => 'info@rutrue.ru',
        //    'to' => 'info@rutrue.ru',
        //    'subject' => 'Ваш заказ принят',
        //    'html' => 'Спасибо за заказ!Номер: 12345',
        //    'attaches' => [
        //        [
        //            'name' => 'Мой файл.pdf', // необязательно, без указание файла будет название файла оригинальное
        //            'path' => storage_path('app/public/file.pdf') // Путь в storage
        //        ],
        //        [
        //            'url' => 'https://t3.ftcdn.net/jpg/03/06/48/88/360_F_306488873_EA34BzCGxmTmn3DRhDcrYiani5Vp8vSD.jpg',
        //        ]
        //    ]
        //]);

        // Отправка с шаблоном
        return Sendsay::sendTransactionalMail([
            'to' => 'info@rutrue.ru',
            'from' => 'info@rutrue.ru',
            'draft_id' => '85', // ID шаблона
            'subject' => 'Ваш заказ принят',
            'text' => 'Привет',
            'extra' => [
                'foo' => 'Содержимое которое я написал в foo',
            ],
            'attaches' => [
                [
                    'name' => 'Мой файл.pdf', // необязательно, без указание файла будет название файла оригинальное
                    'path' => storage_path('app/public/file.pdf') // Путь в storage
                ],
                [
                    'url' => 'https://t3.ftcdn.net/jpg/03/06/48/88/360_F_306488873_EA34BzCGxmTmn3DRhDcrYiani5Vp8vSD.jpg',
                ]
            ]
        ]);
    }

    public function sendEmailDependency(SendsayServiceInterface $emailDriver)
    {
        // Отправка через внедрение
        return $emailDriver->sendTransactionalMail([
            'to' => 'info@rutrue.ru',
            'subject' => 'Ваш заказ принят',
            'text' => 'Спасибо за заказ №12345',
        ]);
    }

    public function sendEmailNotification()
    {
        // отправляем как уведомление

        // Создаем или находим пользователя
        $user = User::firstOrCreate(
            ['email' => 'test@example.com'],
            [
                'name' => 'Test User',
                'phone' => '79991112233',
                'password' => bcrypt('password'),
                'email' => 'info@rutrue.ru'
            ]
        );

        try {
            // Вариант 1: Получаем результат через канал напрямую
            $notification = new InvoicePaid('12345');
            $channel = app(SendsayChannel::class);
            $apiResponse = $channel->send($user, $notification);

            // Вариант 2: Через стандартный механизм уведомлений
            // $user->notify($notification);
            // $apiResponse = ['status' => 'sent']; // Если не нужен ответ API

            // Логируем для проверки
            Log::info('EMAIL отправлено', [
                'email' => $user->email,
                'api_response' => $apiResponse
            ]);

            return response()->json([
                'status' => 'success',
                'message' => "EMAIL отправлено на почту: {$user->email}",
                'api_response' => $apiResponse
            ]);

        } catch (\Exception $e) {
            Log::error('Ошибка отправки EMAIL', [
                'email' => $user->email,
                'error' => $e->getMessage()
            ]);

            return response()->json([
                'status' => 'error',
                'message' => "Ошибка: " . $e->getMessage()
            ], 500);
        }

    }
}
```

###  Health Score

15

—

LowBetter than 3% of packages

Maintenance38

Infrequent updates — may be unmaintained

Popularity1

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity14

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/24e0394f91c11b3f15ff57bafdc469fddf59904a8e4d69c302f61fffe1f67bc8?d=identicon)[rutrue](/maintainers/rutrue)

---

Top Contributors

[![lacoste-sochi](https://avatars.githubusercontent.com/u/42961050?v=4)](https://github.com/lacoste-sochi "lacoste-sochi (3 commits)")

### Embed Badge

![Health badge](/badges/rutrue-laravel-sendsay/health.svg)

```
[![Health](https://phpackages.com/badges/rutrue-laravel-sendsay/health.svg)](https://phpackages.com/packages/rutrue-laravel-sendsay)
```

###  Alternatives

[tijsverkoyen/css-to-inline-styles

CssToInlineStyles is a class that enables you to convert HTML-pages/files into HTML-pages/files with inline styles. This is very useful when you're sending emails.

5.8k505.3M227](/packages/tijsverkoyen-css-to-inline-styles)[minishlink/web-push

Web Push library for PHP

1.9k12.0M53](/packages/minishlink-web-push)[laravel-notification-channels/twilio

Provides Twilio notification channel for Laravel

2587.7M12](/packages/laravel-notification-channels-twilio)[spatie/url-signer

Generate a url with an expiration date and signature to prevent unauthorized access

4422.3M16](/packages/spatie-url-signer)[mattketmo/email-checker

Throwaway email detection library

2742.0M5](/packages/mattketmo-email-checker)[laravel-notification-channels/discord

Laravel notification driver for Discord.

2371.3M11](/packages/laravel-notification-channels-discord)

PHPackages © 2026

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