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

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

mailgreet/mailgreet-laravel
===========================

Official MailGreet SDK for Laravel — send transactional emails, manage subscribers, and use as a native Laravel mailer

00PHP

Since Feb 28Pushed 2mo agoCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

MailGreet for Laravel
=====================

[](#mailgreet-for-laravel)

Official Laravel SDK for [MailGreet](https://mailgreet.com) — send transactional emails, manage subscribers, and use as a native Laravel mailer.

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

[](#installation)

```
composer require mailgreet/mailgreet-laravel
```

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

[](#configuration)

Add your API key to `.env`:

```
MAILGREET_API_KEY=mailgreet_xxxxx
```

Optionally publish the config file:

```
php artisan vendor:publish --tag=mailgreet-config
```

Quick Start — Facade
--------------------

[](#quick-start--facade)

```
use MailGreet\Laravel\Facades\MailGreet;

// Send an email
MailGreet::emails()->send([
    'from' => 'hello@yourdomain.com',
    'to' => 'user@gmail.com',
    'subject' => 'Hello from MailGreet',
    'html' => 'It works!',
]);
```

Using as Laravel Mailer
-----------------------

[](#using-as-laravel-mailer)

MailGreet integrates as a native Laravel mail transport. Add the mailer to `config/mail.php`:

```
'mailers' => [
    // ... other mailers

    'mailgreet' => [
        'transport' => 'mailgreet',
    ],
],
```

Set it as your default mailer in `.env`:

```
MAIL_MAILER=mailgreet
```

Now use Laravel's standard Mail facade:

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

Mail::to('user@gmail.com')->send(new WelcomeEmail());
```

API Resources
-------------

[](#api-resources)

### Emails

[](#emails)

```
// Send a single email
MailGreet::emails()->send([
    'from' => 'hello@yourdomain.com',
    'to' => 'user@gmail.com',
    'subject' => 'Hello',
    'html' => 'World',
    'text' => 'World',                  // Optional plain-text
    'cc' => ['cc@example.com'],         // Optional
    'bcc' => ['bcc@example.com'],       // Optional
    'reply_to' => 'reply@example.com',  // Optional
    'track_opens' => true,              // Optional
    'track_clicks' => true,             // Optional
    'metadata' => ['order_id' => '123'],// Optional
]);

// Send batch (up to 100)
MailGreet::emails()->sendBatch([
    ['from' => '...', 'to' => '...', 'subject' => '...', 'html' => '...'],
    ['from' => '...', 'to' => '...', 'subject' => '...', 'html' => '...'],
]);

// List sent emails
$emails = MailGreet::emails()->list(['page' => 1, 'limit' => 25, 'status' => 'sent']);

// Get email details
$email = MailGreet::emails()->get('email-uuid');

// Email statistics
$stats = MailGreet::emails()->stats();
```

### Subscribers

[](#subscribers)

```
// Create
$subscriber = MailGreet::subscribers()->create([
    'email' => 'user@example.com',
    'first_name' => 'John',
    'last_name' => 'Doe',
    'group_ids' => ['group-uuid'],
]);

// List
$subscribers = MailGreet::subscribers()->list(['status' => 'active', 'search' => 'john']);

// Get / Update / Delete
$subscriber = MailGreet::subscribers()->get('subscriber-uuid');
MailGreet::subscribers()->update('subscriber-uuid', ['first_name' => 'Jane']);
MailGreet::subscribers()->delete('subscriber-uuid');

// Statistics
$stats = MailGreet::subscribers()->stats();

// Async import
MailGreet::subscribers()->importAsync([
    'subscribers' => [
        ['email' => 'a@example.com', 'first_name' => 'A'],
        ['email' => 'b@example.com', 'first_name' => 'B'],
    ],
    'group_ids' => ['group-uuid'],
]);
```

### Forms

[](#forms)

```
$forms = MailGreet::forms()->list();
$form = MailGreet::forms()->get('form-uuid');
$stats = MailGreet::forms()->stats('form-uuid');
$submissions = MailGreet::forms()->submissions('form-uuid', ['page' => 1]);
```

### Groups &amp; Fields

[](#groups--fields)

```
$groups = MailGreet::groups()->list();
$fields = MailGreet::fields()->list();
```

### Account

[](#account)

```
$account = MailGreet::account()->me();
```

Webhook Verification
--------------------

[](#webhook-verification)

```
use MailGreet\Laravel\Webhooks\WebhookSignature;

Route::post('/webhook/mailgreet', function (Request $request) {
    $isValid = WebhookSignature::verify(
        $request->getContent(),
        $request->header('X-Webhook-Signature'),
        config('services.mailgreet.webhook_secret')
    );

    if (!$isValid) {
        abort(401, 'Invalid webhook signature');
    }

    $event = $request->input('event');
    $data = $request->input('data');

    // Handle the event...

    return response('OK', 200);
});
```

Error Handling
--------------

[](#error-handling)

```
use MailGreet\Laravel\Exceptions\ApiException;
use MailGreet\Laravel\Exceptions\RateLimitException;
use MailGreet\Laravel\Exceptions\MailGreetException;

try {
    MailGreet::emails()->send([...]);
} catch (RateLimitException $e) {
    Log::warning("Rate limited. Retry after {$e->getRetryAfterSeconds()}s");
} catch (ApiException $e) {
    Log::error("API error {$e->getStatusCode()}: {$e->getMessage()}");
    Log::error('Validation errors:', $e->getValidationErrors() ?? []);
} catch (MailGreetException $e) {
    Log::error("MailGreet error: {$e->getMessage()}");
}
```

Configuration Options
---------------------

[](#configuration-options)

`.env` VariableDefaultDescription`MAILGREET_API_KEY`—Your MailGreet API key (required)`MAILGREET_BASE_URL``https://api.mailgreet.com`API base URL`MAILGREET_TIMEOUT``30`Request timeout in seconds`MAILGREET_MAX_RETRIES``3`Max retries on 5xx/network errorsRequirements
------------

[](#requirements)

- PHP 8.1+
- Laravel 10, 11, or 12

License
-------

[](#license)

MIT

###  Health Score

19

—

LowBetter than 10% of packages

Maintenance57

Moderate activity, may be stable

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity12

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/0e37258f9ebb396cc492143839735158aa266dbca901e91f4abb98874c83b946?d=identicon)[mailgreet](/maintainers/mailgreet)

---

Top Contributors

[![mailgreet](https://avatars.githubusercontent.com/u/210669809?v=4)](https://github.com/mailgreet "mailgreet (1 commits)")

### Embed Badge

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

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

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