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)015.4k↓44.4%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 1mo 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 80% 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

832d 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

[laravel-notification-channels/telegram

Telegram Notifications Channel for Laravel

1.1k3.4M35](/packages/laravel-notification-channels-telegram)[mckenziearts/laravel-notify

Flexible flash notifications for Laravel

1.7k1.1M5](/packages/mckenziearts-laravel-notify)[propaganistas/laravel-disposable-email

Disposable email validator

5762.6M6](/packages/propaganistas-laravel-disposable-email)[tzsk/sms

A robust and unified SMS gateway integration package for Laravel, supporting multiple providers.

320244.3k6](/packages/tzsk-sms)[vormkracht10/laravel-mails

Laravel Mails can collect everything you might want to track about the mails that has been sent by your Laravel app.

24149.7k](/packages/vormkracht10-laravel-mails)[erag/laravel-disposable-email

A Laravel package to detect and block disposable email addresses.

226102.4k](/packages/erag-laravel-disposable-email)

PHPackages © 2026

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