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

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

data33/laravel-mailgun
======================

Send emails from multiple domains with mailgun

2.0.0(2y ago)016.0k↓62%3MITPHP

Since Aug 15Pushed 2y ago1 watchersCompare

[ Source](https://github.com/Data33/laravel-mailgun)[ Packagist](https://packagist.org/packages/data33/laravel-mailgun)[ Docs](https://github.com/Data33/laravel-mailgun)[ RSS](/packages/data33-laravel-mailgun/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (8)Dependencies (3)Versions (9)Used By (0)

Data33/Laravel-Mailgun
======================

[](#data33laravel-mailgun)

A package for sending emails using the Mailgun HTTP API. One of the main advantages is that you can send emails from any domains connected to your Mailgun API key.

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

[](#installation)

Open your `composer.json` file and add the following to the `require` key:

```
"data33/laravel-mailgun": "^2"

```

---

After adding the key, run composer update from the command line to install the package

```
composer update
```

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

[](#configuration)

Before you can start using the package we need to set some configurations. To do so you must first publish the config file, you can do this with the following `artisan` command.

```
php artisan vendor:publish --provider="Data33\LaravelMailgun\Providers\MailgunServiceProvider" --tag="config"
```

After the config file has been published you can find it at: `config/mailgun.php`

In it you must specify your Mailgun API key.

Usage with Laravel
------------------

[](#usage-with-laravel)

```
Mailgun::send('MAILGUN-URL', 'view', ['viewVariable' => 'value'], function(\Data33\LaravelMailgun\Message $msg){
	$msg->setFromAddress('sender@YOUR-DOMAIN', 'Sender Name')
		->addToRecipient('RECIPIENT-EMAIL', 'Recipient Name')
		->setSubject('Test subject');
});
```

Usage without Laravel
---------------------

[](#usage-without-laravel)

The easiest way to use this package without Laravel is to directly instantiate a `Transporter` of your choice. For example:

```
$mg = new Data33\LaravelMailgun\Transporters\AnlutroCurlTransporter('YOUR-MAILGUN-API-KEY');

$result = $mg->send('MAILGUN-URL', ['html' => 'Test', 'text' => 'Test'], function(\Data33\LaravelMailgun\Message $msg){
	$msg->setFromAddress('sender@YOUR-DOMAIN', 'Sender Name')
		->addToRecipient('RECIPIENT-EMAIL', 'Recipient Name')
		->setSubject('Test subject');
});
```

Upgrade from 1.3.0
------------------

[](#upgrade-from-130)

Since EU domains need calls to a different API URL it seemed fitting to not keep it hardcoded within this package. To upgrade your old code base, change the first argument from *domain name* to the full URL to Mailgun's Messages API for your domain For example:

```
$mg = new Data33\LaravelMailgun\Transporters\AnlutroCurlTransporter('YOUR-MAILGUN-API-KEY');

-$result = $mg->send('mydomain.com', ['html' => 'Test', 'text' => 'Test'], function(\Data33\LaravelMailgun\Message $msg){
+$result = $mg->send('https://api.mailgun.net/v3/mydomain.com/messages', ['html' => 'Test', 'text' => 'Test'], function(\Data33\LaravelMailgun\Message $msg){
	$msg->setFromAddress('sender@YOUR-DOMAIN', 'Sender Name')
		->addToRecipient('RECIPIENT-EMAIL', 'Recipient Name')
		->setSubject('Test subject');
});
```

###  Health Score

35

—

LowBetter than 77% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity27

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity68

Established project with proven stability

 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.

###  Release Activity

Cadence

Every ~390 days

Recently: every ~399 days

Total

8

Last Release

878d ago

Major Versions

1.3.0 → 2.0.02024-02-07

### Community

Maintainers

![](https://www.gravatar.com/avatar/a99e14e2db1cc9e5c119d2e48752b300e3b13602231f375e411b5682f533ea41?d=identicon)[Data33](/maintainers/Data33)

---

Top Contributors

[![Data33](https://avatars.githubusercontent.com/u/195278?v=4)](https://github.com/Data33 "Data33 (14 commits)")

---

Tags

laravelmailgun

### Embed Badge

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

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

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[laravel/horizon

Dashboard and code-driven configuration for Laravel queues.

4.2k95.4M306](/packages/laravel-horizon)[laravel/sail

Docker files for running a basic Laravel application.

1.9k205.7M1.3k](/packages/laravel-sail)[propaganistas/laravel-disposable-email

Disposable email validator

6023.0M7](/packages/propaganistas-laravel-disposable-email)[illuminate/database

The Illuminate Database package.

2.8k54.9M11.6k](/packages/illuminate-database)[laravel/ai

The official AI SDK for Laravel.

1.0k3.2M194](/packages/laravel-ai)

PHPackages © 2026

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