Description
Mailgun is the email automation engine trusted by over 10,000 website and application developers for sending, receiving and tracking emails. By taking advantage of Mailgun’s powerful email APIs, developers can spend more time building awesome websites and less time fighting with email servers. Mailgun supports all of the most popular languages including PHP, Ruby, Python, C# and Java.
One particularly useful feature of this plugin is that it provides you with a way to send email when the server you are on does not support SMTP or where outbound SMTP is restricted since the plug-in uses the Mailgun HTTP API for sending email by default. All you need to use the plugin is a Mailgun account. Mailgun has a free account that lets you send up to 200 emails per day, which is great for testing. Paid subscriptions are available for increased limits.
The latest version of this plugin adds support for Mailgun list subscription. Using the shortcode, you can place a form on an article or page to allow the visitor to subscribe to one or more lists. Using the widget, you can provide subscription functionality in sidebars or anywhere widgets are supported e.g. footers.
The current version of this plugin only handles sending emails, tracking and tagging and list subscription.
Screenshots
Installation
- Upload the
mailgunfolder to the/wp-content/plugins/directory or install directly through the plugin installer - Activate the plugin through the ‘Plugins’ menu in WordPress or by using the link provided by the plugin installer
- Visit the settings page in the Admin at
Settings -> Mailgunand configure the plugin with your account details - Click the Test Configuration button to verify that your settings are correct.
- Click View Available Lists to review shortcode settings for lists in your Mailgun account that you may wish to help users subscribe to
FAQ
- Testing the configuration fails when using the HTTP API
Your web server may not allow outbound HTTP connections. Set Use HTTP API to “No”, and fill out the configuration options to SMTP and test again.
- Testing the configuration fails when using SMTP
Your web server may not allow outbound SMTP connections on port 465 for secure connections or 587 for unsecured connections. Try changing Use Secure SMTP to “No” or “Yes” depending on your current configuration and testing again. If both fail, try setting Use HTTP API to “Yes” and testing again.
If you have to use SMTP and something is still going horribly wrong, enable debug mode in WordPress and also add the MG_DEBUG_SMTP constant to your wp-config.php, like so:
define( 'MG_DEBUG_SMTP', true );
- Can this be configured globally for WordPress Multisite?
Yes, using the following constants that can be placed in wp-config.php:
MAILGUN_USEAPI Type: boolean
MAILGUN_APIKEY Type: string
MAILGUN_DOMAIN Type: string
MAILGUN_USERNAME Type: string
MAILGUN_PASSWORD Type: string
MAILGUN_SECURE Type: boolean
MAILGUN_FROM_NAME Type: string
MAILGUN_FROM_ADDRESS Type: string
-
What hooks are available for use with other plugins?
mg_use_recipient_vars_syntax
Mutates messages to use recipient variables syntax – see
https://documentation.mailgun.com/user_manual.html#batch-sending for more info.Should accept a list of
Toaddressses.Should only return
trueorfalse.mg_mutate_message_body
Allows an external plugin to mutate the message body before sending.Should accept an array,
$body.Should return a new array to replace
$body.mg_mutate_attachments
Allows an external plugin to mutate the attachments on the message before
sending.Should accept an array,
$attachments.Should return a new array to replace
$attachments.
Reviews
Love Mailgun!
I could not be happier with Mailgun! Regardless of the form plugin I use, sometimes email from a WordPress website doesn’t work. With Mailgun I have a solution for all of my client sites. The stress of troubleshooting email is over.
Easy setup and integration
The plugin works great for it’s basic feature of replacing wp_mail().
Unfortunately didn’t have a chance to try the mailing list features.
Easy peasy
Very quick and easy to setup
Works well and Good Support
Simple to use and uses wp_mail function without issue.
Have been impressed with the support which resolved a content-type issue within a day of reporting.
Can recommend Mailgun and this plugin.
Thanks for supporting this Mailgun.
The plugin stop working in the last version
The plugin did not have updates for a year. In the last month, I receive 10 updates and in the last update the plugin stop working.
The message with this issue:The plugin could not be activated because it caused a fatal error.
Any idea?
Thank you very much!
Thank you guys
Thank you for the very active development. Bugs are fixed before they are even noticed, This plugin completes mailgun wordpress integration.
Contributors & Developers
“Mailgun for WordPress” is open source software. The following people have contributed to this plugin.
ContributorsTranslate “Mailgun for WordPress” into your language.
Interested in development?
Browse the code or subscribe to the development log by RSS.
Changelog
1.5.8.2 (2017-02-27):
- Fix a bug causing empty tags to be sent with messages (#51)
- Add
mg_mutate_message_bodyhook to allow other plugins to modify the message body before send - Add
mg_mutate_attachmentshook to allow other plugins to modify the message attachments before send - Fix a bug causing the AJAX test to fail incorrectly.
1.5.8.1 (2017-02-06):
- Fix “Undefined property: MailgunAdmin::$hook_suffix” (#48)
- Fix “Undefined variable: from_name on every email process” (API and SMTP) (#49)
- Admin code now loads only on admin user access
1.5.8 (2017-01-23):
- Rewrite a large chunk of old SMTP code
- Fix a bug with SMTP + “override from” that was introduced in 1.5.7
- SMTP debug logging is now controlled by
MG_DEBUG_SMTPconstant
1.5.7.1 (2017-01-18):
- Fix an odd
Undefined property: MailgunAdmin::$defaultswhen saving config - Fix strict mode notice for using
$mailgun['override-from']without checkingisset
1.5.7 (2017-01-04):
- Add better support for using recipient variables for batch mailing.
- Clarify wording on
From Addressnote - Detect from name and address for
phpmailer_init/ SMTP now will honour Mailgun “From Name / From Addr” settings - SMTP configuration test will now provide the error message, if the send fails
- Fix
undefined variable: content_typeerror inwp-mail.php(https://wordpress.org/support/topic/minor-bug-on-version-version-1-5-6/#post-8634762) - Fix
undefined index: override-fromerror inwp-mail.php(https://wordpress.org/support/topic/php-notice-undefined-index-override-from/)
1.5.6 (2016-12-30):
- Fix a very subtle bug causing fatal errors with older PHP versions < 5.5
- Respect
wp_mail_content_type(#37 – @FPCSJames)
1.5.5 (2016-12-27):
- Restructure the
admin_noticescode - Restructure the “From Name” / “From Address” code
- Add option to override “From Name” / “From Address” setting set by other plugins
- Fix a bug causing default “From Name” / “From Address” to be always applied in some cases
- Moved plugin header up in entrypoint file (https://wordpress.org/support/topic/plugin-activation-due-to-header/#post-8598062)
- Fixed a bug causing “Override From” to be set to “yes” after upgrades
1.5.4 (2016-12-23):
- Changed some missed bracketed array usages to
array()syntax - Fix
wp_mail_from/wp_mail_from_namenot working on old PHP / WP versions - Add a wrapper for using
mime_content_type/finfo_file
1.5.3 (2016-12-22):
- Changed all bracketed array usages to
array()syntax for older PHP support - Redesigned
Content-Typeprocessing code to not make such large assumptions - Mailgun logo is now loaded over HTTPS
- Fixed undefined variable issue with from email / from name code
1.5.2 (2016-12-22):
- Added option fields for setting a From name and address
1.5.1 (2016-12-21):
- Fixed an issue causing plugin upgrades from <1.5 -> >=1.5 to deactivate
1.5 (2016-12-19):
- Added Catalan language support (@DavidGarciaCat)
- Added Spanish language support (@DavidGarciaCat)
- Added German language support (@lsinger)
- Fixed incorrect SMTP hostname
- Applied PSR standards across codebase
- Applied open tracking bugfix
- Applied tags bugfix
- Applied
Mailgun Listsadmin panel bugfix - Fixed click tracking dropdown
- Fixed click tracking and open tracking
- Now try to process all sent mails as HTML, see L201 wp-mail.php for details
- Mailgun logo now loads on both admin pages 😉
- Now using the Mailgun API v3 endpoint!
- Configuration test will now present either an error from the API or the HTTP response code + message
1.4.1 (2015-12-01):
- Clarify compatibility with WordPress 4.3
1.4 (2015-11-15):
- Added shortcode and widget support for list subscription
1.3.1 (2014-11-19):
- Switched to Semantic Versioning
- Fixed issue with campaigns and tags
1.3 (2014-08-25):
- Added check to ignore empty attachments
1.2 (2014-08-19):
- Fixed errors related to undefined variable. https://github.com/mailgun/wordpress-plugin/pull/3
1.1 (2013-12-09):
- Attachments are now handled properly.
- Added ability to customize tags and campaigns.
- Added ability to toggle URL and open tracking.
1.0 (2012-11-27):
- Re-release to update versioning to start at 1.0 instead of 0.1
0.1 (2012-11-21):
- Initial Release

