Back to main menu


Introducing the Mailgun module for Drupal

Looking for a Mailgun module to fit Drupal? Jeffrey Chen goes into the details of his Mailgun module and documentation. Read more...



This post was contributed by Jeffrey Chen at Peano Inc.

One thing Mailgun and Drupal have in common is that they’re both developer-centric services, making it extremely easy to extend and build on top of their structure and APIs.

I discovered Mailgun when I was working with a client that needed an email service with a flexible pricing structure to support their fluctuant email sending volume that varied greatly from month to month. Mailgun was the perfect fit for their requirements. We use Drupal for all of our sites and since there wasn’t an existing integration built for Drupal, we went ahead and built the module.

We built a basic integration with the following key features:

  • Queue support: Queuing enables messages to be sent on cron runs, which comes in handy for sending a large amount of messages.

  • Support for all Mailgun message parameters: You can easily specify BCCs, add tags, disable tracking for just one message, or add your own header by simply passing over the parameters and the module will handle them nicely.

  • Smart domain recognition mechanism: Mailgun APIs require you to specify the “working domain” on which the operation takes place and this module automatically recognizes the domain you’re working on. For example, when you’re sending a message, the module decomposes the domain in the From address and intelligently matches it to a domain you have in your profile, even if it’s a subdomain.

  • Built-in HTML support: The Mailgun module utilizes Mailgun’s server-level support for handling HTML messages. This means MIME is no longer your hassle.

  • Fully extensible: Simply call the mailgungetclient() function and use the client object to perform any operation you want.

The module is available here and you can access the documentation here. Feel free to contribute to the module by helping out in the issue queue. You can also give small donations to help support the development and maintenance of the module.

We hope you find this integration useful and welcome your comments and suggestions.

Related readings

An expanded Mailgun product suite to transform email deliverability

Today marks a special day for Sinch Mailgun. For over a decade, our focus has been to provide the best email experience for businesses all around the world. Now, we take...

Read more

Privacy, automatic engagements, and Mailgun’s bot detection

Now more than ever, users are concerned about their data privacy and what steps they can take to protect their personal information. And that’s something big players in the tech...

Read more

How does Mailgun keep your emails protected?

On the surface, email seems relatively harmless – but dig a bit deeper and you’ll discover there’s a treasure trove of personally identifiable information (PII) at risk. This risk...

Read more

Popular posts

Email inbox.

Build Laravel 10 email authentication with Mailgun and Digital Ocean

When it was first released, Laravel version 5.7 added a new capability to verify user’s emails. If you’ve ever run php artisan make:auth within a Laravel app you’ll know the...

Read more

Mailgun statistics.

Sending email using the Mailgun PHP API

It’s been a while since the Mailgun PHP SDK came around, and we’ve seen lots of changes: new functionalities, new integrations built on top, new API endpoints…yet the core of PHP...

Read more

Statistics on deliverability.

Here’s everything you need to know about DNS blocklists

The word “blocklist” can almost seem like something out of a movie – a little dramatic, silly, and a little unreal. Unfortunately, in the real world, blocklists are definitely something you...

Read more

See what you can accomplish with the world's best email delivery platform. It's easy to get started.Let's get sending
CTA icon