Sector(s)
Visit the site
Visit the siteOrganizations Involved
Community contributions
We started by providing some patches for Drupal 7 version in 2016. Then we finally took over the module maintenance and provided support for D7 and D8/D9 versions. During this time, DevBranch members supplied 100+ commits of total ~150.
A bunch of issues was taken care of during the annual Global Contribution Weekends.
We’d like to give special thanks to the following people:
- Dan Reinders (SpartyDan), who supported the transferring of module ownership;
- Jakob Gehring (codewhisper), who fixed critical issues and brought other changes together in the fork. It allowed other people to continue using Mailgun until drupal.org hosted module has been fixed;
- All the contributors, who were actively involved in the module maintenance.
As a web development vendor, we are responsible for the technical side of our partners’ projects. To handle email delivery, we often suggest flexible 3-party providers to integrate with.
The first time we integrated Mailgun to Drupal project was in 2016. One of our partners had a problem with their sending reputation through their existing email provider. So we started looking for other services that had Drupal 7 integration. There were only a few options available, and Mailgun’s free plan seemed like the best choice.
The killer feature for the first project were tags and tags-based analytics, it helped our partner to identify which emails were more engaging (had a better open rate):

The further usage of Mailgun showed its flexibility so we started digging in deeper.
As at the time the version of Mailgun to Drupal Integration was new, so our team took on the maintenance to see if we could help it mature.
Since then, we have constantly been improving the module, and recommending Mailgun to our partners, thus integrating it on dozens of projects.
There have been no major accidents since 2016 and we consider Mailgun a reliable service.
About the project
The main goals of the project were to:
- allow Drupal instances to send emails via Mailgun API;
- make the installation and configuration as simple as possible.
The additional goals/requirements that we took into account were that the module should:
- be a part of Mail System ecosystem;
- be customizable (including the resulting content);
- expose some configuration (with reasonable defaults) to allow site builders to have it up and running without development skills.
Mailgun module uses the official Mailgun SDK for PHP and provides a Mail System plugin, allowing to use Mail System functionality. It can be used as an email sender and (or) email formatter, and also chosen to deliver either all outcoming emails or selected types. It also provides an extra plugin - Mailgun mailer (queued), that adds emails to the internal Drupal queue and processes the list on cron.
The Drupal configuration page is very straightforward. The initial view displays the most important field - Mailgun API key:

After saving the key, the whole form is available:

Advanced settings contain tracking settings and the email formatting configuration. Defaults are fine in most cases.
Mailgun provides a pretty decent API, that can be reviewed on the documentation page.
The Mailgun module implements the following API functionality:
1. Messages
This is core functionality. It just sends a message by assembling parameters from the message and module configuration.
2. Domains
The list of available domains is retrieved on the module configuration page, so we can select which one should be used. It also provides a feature to retrieve the domain name from the sender address, which makes it more flexible:

3. Tags
Any custom tag can be supplied by developers in the codebase allowing to group emails into some groups. The module allows to add a tag with mail keys (Drupal internal identifiers) on the module configuration page:

This functionality was recently implemented as a sub-module and allows to group contacts into some groups (lists) and send emails to the group via one API request.
It is not implemented yet, but we already have a feature request and some progress has been made.
We’ll keep an eye on the requests from our community and will be happy to accept incoming patches/merge requests that connect Mailgun features into Drupal ecosystem.
Eventually, some automated tests were added. They cover some parts of module functionality and help us to verify patches from other contributors.
At this moment, both versions (D7 and D10) have stable releases and are used by ~2,500 sites according to the usage statistics. Currently, the module does not support PHP 8 because of some issues/limitations in module dependencies.
Why Drupal was chosen
To connect Drupal with Mailgun products, one needs Drupal. The decision was tough but finally, we decided to use Drupal :)
Technical Specifications
Drupal version: