PHPackages                             yugo/laravel-maily - 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. yugo/laravel-maily

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

yugo/laravel-maily
==================

Laravel mail transport integration for Maily.id API.

v1.1.1(1mo ago)0113[1 issues](https://github.com/yugo412/laravel-maily/issues)MITPHPPHP ^8.2CI passing

Since May 28Pushed 1mo agoCompare

[ Source](https://github.com/yugo412/laravel-maily)[ Packagist](https://packagist.org/packages/yugo/laravel-maily)[ RSS](/packages/yugo-laravel-maily/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (3)Dependencies (14)Versions (4)Used By (0)

Maily for Laravel
=================

[](#maily-for-laravel)

SMTP-free Laravel mail transport for [Maily.id](https://maily.id).

Why this package?
-----------------

[](#why-this-package)

Maily currently provides an API-only email service without SMTP support. This package allows Laravel applications to use Maily through Laravel Mail without changing existing mail implementations.

Features
--------

[](#features)

- Native Laravel Mail integration
- Queue compatible
- Notification compatible
- API-based delivery
- SMTP-free setup
- Retry support

Requirements
------------

[](#requirements)

- PHP 8.2+
- Laravel 11 or newer

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

[](#installation)

Install the package via Composer:

```
composer require yugo/laravel-maily
```

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

[](#configuration)

Add the following configuration to your `config/services.php` file:

```
'maily' => [
    'key' => env('MAILY_KEY'),
    'endpoint' => env('MAILY_ENDPOINT', 'https://maily.id'),
    'timeout' => (int) env('MAILY_TIMEOUT', 15),
    'retry' => (int) env('MAILY_RETRY', 3),
    'retry_delay' => (int) env('MAILY_RETRY_DURATION', 1_000),
],
```

Then add your Maily credentials to `.env`:

```
MAIL_MAILER=maily

MAILY_KEY=ml_live_your_api_key_here

# optional
MAILY_ENDPOINT=https://maily.id
MAILY_TIMEOUT=15
MAILY_RETRY=3
MAILY_RETRY_DURATION=1000
```

Usage
-----

[](#usage)

Once configured, Laravel Mail will automatically use the Maily transport.

### Raw Email

[](#raw-email)

```
use Illuminate\Support\Facades\Mail;

Mail::raw('Hello from Maily!', function ($message) {
    $message
        ->to('user@example.com')
        ->subject('Test Email');
});
```

### Mailables

[](#mailables)

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

### Queued Mail

[](#queued-mail)

```
Mail::to($user)->queue(new WelcomeMail());
```

Events
------

[](#events)

The package dispatches a `MailySentEvent` event after a successful email request.

This can be useful for:

- logging
- analytics
- quota monitoring
- debugging
- admin dashboards

### Listening to the Event

[](#listening-to-the-event)

```
