PHPackages                             select-co/module-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. select-co/module-mailgun

ActiveMagento2-module[Mail &amp; Notifications](/categories/mail)

select-co/module-mailgun
========================

N/A

v1.0.1(9mo ago)16ProprietaryPHP

Since Jul 23Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/SelectCo/magento2-module-mailgun)[ Packagist](https://packagist.org/packages/select-co/module-mailgun)[ RSS](/packages/select-co-module-mailgun/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (3)Versions (3)Used By (0)

Magento 2 Mailgun Module
========================

[](#magento-2-mailgun-module)

[![Github license](https://camo.githubusercontent.com/a3f6dd035498f0fd499db8b9c114e22824d985c01483893896ad8e344e59df0b/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f53656c656374436f2f6d6167656e746f322d6d6f64756c652d6d61696c67756e "Github license")](https://github.com/SelectCo/magento2-module-mailgun/blob/main/LICENSE)[![Open issues](https://camo.githubusercontent.com/1f7159c82c000145a0c8d7789c78c6c0d7cb5438891b95d03fa24857a9209bf4/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f53656c656374436f2f6d6167656e746f322d6d6f64756c652d6d61696c67756e "Open issues")](https://github.com/SelectCo/magento2-module-mailgun/issues)[![Open Pull Requests](https://camo.githubusercontent.com/bb31454acb3ae2c56a79c7df2e883223787af8de38c0c9a3029befb106bdb40e/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732d70722f53656c656374436f2f6d6167656e746f322d6d6f64756c652d6d61696c67756e "Open Pull Requests")](https://github.com/SelectCo/magento2-module-mailgun/pulls)[![Last commit](https://camo.githubusercontent.com/0ea274e840c8d78c61839259d1225a15e18c2ece111197523cd73f15f8252bdd/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6173742d636f6d6d69742f53656c656374436f2f6d6167656e746f322d6d6f64756c652d6d61696c67756e "Last commit")](https://github.com/SelectCo/magento2-module-mailgun/commits/main)

Magento 2 module that routes all outgoing Magento emails through the Mailgun HTTP API.

When enabled, the module replaces Magento's default mail transport with a plugin that submits messages to Mailgun, including HTML content and attachments. It also provides an admin configuration section with a built-in "Send Test Email" tool to validate your setup.

Features
--------

[](#features)

- Send all Magento transactional emails via Mailgun API
- Supports US and EU Mailgun endpoints
- Sends HTML content and attachments
- Optional debug mode and Mailgun Request Bin (Pastebin) integration for inspecting requests
- Admin "Send Test Email" button to quickly verify configuration

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

[](#requirements)

- Magento 2 (tested with 2.3.5)
- A Mailgun account with a verified sending domain
- PHP version compatible with your Magento installation
- Composer dependencies (handled via this module):
    - mailgun/mailgun-php ^2.4
    - php-http/multipart-stream-builder 1.0.0

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

[](#installation)

You can install this module either via Composer or by placing it in app/code.

### Composer (preferred)

[](#composer-preferred)

1. Require the package:
    - If available via your satis/packagist: `composer require select-co/module-mailgun`
    - If using this repository directly, add a VCS repository entry in your root composer.json and then `composer require select-co/module-mailgun`.
2. Enable and set up the module:
    - `bin/magento module:enable SelectCo_Mailgun`
    - `bin/magento setup:upgrade`
    - In production mode: `bin/magento setup:di:compile` and `bin/magento setup:static-content:deploy -f`

### Manual installation (app/code)

[](#manual-installation-appcode)

1. Copy this directory to `app/code/SelectCo/Mailgun`.
2. Run:
    - `bin/magento module:enable SelectCo_Mailgun`
    - `bin/magento setup:upgrade`
    - In production mode: `bin/magento setup:di:compile` and `bin/magento setup:static-content:deploy -f`

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

[](#configuration)

Admin Path: Stores &gt; Configuration &gt; SelectCo Settings &gt; Mailgun Config

- General

    - Enabled: Turn Mailgun delivery on/off. When disabled, Magento uses its default transport.
- API

    - Sending Domain Name: Your Mailgun sending domain (e.g., mg.example.com)
    - API Key: Your Mailgun Private API key (stored encrypted; treated as sensitive)
    - Mailgun Endpoint: Choose between:
        -  (US Region)
        -  (EU Region)
- Debug

    - Debug Enabled: Enable HTTP client debug output on requests. Note: Mailgun may accept messages in test/debug flows but not deliver them; refer to your Mailgun plan for billing implications.
    - Pastebin Enabled: Enable sending requests to a Mailgun Request Bin for inspection
    - Pastebin Id: The request bin ID to use when Pastebin is enabled
- Send Test Email

    - Provides a From and To field and a "Send Test" button. The request is sent to the controller `selectco_mailgun/system_config_mailgun/test` and the result is displayed inline.

How it works
------------

[](#how-it-works)

- The module declares a plugin on `Magento\Email\Model\Transport` (see etc/di.xml). When the module is enabled, `aroundSendMessage` intercepts `sendMessage()` and delegates delivery to `SelectCo\Mailgun\Model\Mailgun`.
- The Mailgun model builds parameters from Magento's email message object:
    - to/cc/bcc/from/reply-to, subject
    - html body (decoded from quoted-printable)
    - attachments (filename + raw content)
- Endpoint selection:
    - If Pastebin is enabled and a Pastebin Id is set, requests are sent to `http://bin.mailgun.net/{id}` for inspection
    - Otherwise, requests are sent to the chosen Mailgun API endpoint (US/EU)

Email templates
---------------

[](#email-templates)

- Test email template ID: `selectco_mailgun_test_email`
- File: `view/adminhtml/email/test_email.html`

Troubleshooting
---------------

[](#troubleshooting)

- Verify your Mailgun domain is verified and authorized to send
- Ensure DNS records (SPF/DKIM) are correctly configured for your sending domain
- Make sure the API key and endpoint match your Mailgun region
- Use Debug and/or Pastebin to inspect payloads if messages are not delivered
- Check Magento logs for exceptions and the Mailgun event logs for rejected messages

License
-------

[](#license)

MIT. See LICENSE.

Support
-------

[](#support)

If you have a feature request or spotted a bug or a technical problem, create a GitHub issue.

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance73

Regular maintenance activity

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity37

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.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

299d ago

### Community

Maintainers

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

---

Top Contributors

[![adrianb11](https://avatars.githubusercontent.com/u/77499644?v=4)](https://github.com/adrianb11 "adrianb11 (5 commits)")

### Embed Badge

![Health badge](/badges/select-co-module-mailgun/health.svg)

```
[![Health](https://phpackages.com/badges/select-co-module-mailgun/health.svg)](https://phpackages.com/packages/select-co-module-mailgun)
```

###  Alternatives

[mailgun/mailgun-php

The Mailgun SDK provides methods for all API functions.

1.1k28.9M168](/packages/mailgun-mailgun-php)[magepal/magento2-gmailsmtpapp

Magento 2 SMTP Extension - Configure Magento 2 to send all transactional email using Gmail, G Suite, Amazon SES, Office360, Mailgun, SendGrid, Mandrill or any other SMTP servers

3321.8M2](/packages/magepal-magento2-gmailsmtpapp)[mailchimp/mc-magento2

Connect MailChimp with Magento

1611.8M3](/packages/mailchimp-mc-magento2)[cspoo/swiftmailer-mailgun-bundle

Swiftmailer Mailgun bundle

1031.1M](/packages/cspoo-swiftmailer-mailgun-bundle)[dotdigital/dotdigital-magento2-extension

Dotdigital for Magento 2

50374.2k18](/packages/dotdigital-dotdigital-magento2-extension)

PHPackages © 2026

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