Giter Site home page Giter Site logo

wordpress-plugin's Introduction

Mailgun for WordPress

Contributors: mailgun, sivel, lookahead.io, m35dev, alanfuller Tags: mailgun, smtp, http, api, mail, email Tested up to: 6.4.3 Stable tag: 1.9.9 License: GPLv2 or later

Easily send email from your WordPress site through Mailgun using the HTTP API or SMTP.

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 now supports regions. Select either U.S./North America or Europe to choose the API endpoint from which you will send email.

The current version of this plugin only handles sending emails, tracking and tagging and list subscription.

Installation

  1. Upload the mailgun folder to the /wp-content/plugins/ directory or install directly through the plugin installer
  2. Activate the plugin through the 'Plugins' menu in WordPress or by using the link provided by the plugin installer
  3. Visit the settings page in the Admin at Settings -> Mailgun and configure the plugin with your account details
  4. Click the Test Configuration button to verify that your settings are correct.
  5. Click View Available Lists to review shortcode settings for lists in your Mailgun account that you may wish to help users subscribe to

== Frequently Asked Questions ==

  • 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:

Important note

Constant MAILGUN_USEAPI IS REQUIRED

MAILGUN_REGION       Type: string   Choices: 'us' or 'eu'
     ex. define('MAILGUN_REGION', 'us');
MAILGUN_USEAPI       Type: boolean  Choices: '0' or '1' (0 = false/no)
MAILGUN_APIKEY       Type: string
MAILGUN_DOMAIN       Type: string
MAILGUN_USERNAME     Type: string
MAILGUN_PASSWORD     Type: string
MAILGUN_SECURE       Type: boolean  Choices: '0' or '1' (0 = false/no)
MAILGUN_SECTYPE      Type: string   Choices: 'ssl' or 'tls'
MAILGUN_FROM_NAME    Type: string
MAILGUN_FROM_ADDRESS Type: string
MAILGUN_TRACK_CLICKS Type: string Choices: 'yes' or 'no'
MAILGUN_TRACK_OPENS  Type: string Choices: 'yes' or 'no'
  • 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 To addresses.

Should only return true or false.

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.

  • 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/en/latest/user_manual.html#batch-sending for more info.

Should accept a list of To addresses.

Should only return true or false.

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.

== Screenshots ==

  1. Configuration options for using the Mailgun HTTP API
  2. Configuration options for using the Mailgun SMTP servers
  3. Administration option to View Available Lists for subscription
  4. Setting up a Subscription Widget
  5. Using a Subscription Code
  6. Subscription Form Seen By Site Visitors

== Changelog == = 1.9.8 (2024-02-25): =

  • Improve admin notices about not fully configured plugin
  • Small code cleaning

= 1.9.7 (2024-01-03): =

  • Ensure defaults are always set to remove warnings in PHP 8.1+

= 1.9.6 (2023-09-10): =

  • Added typehints to methods
  • Added code for making plugin WP VIP GO compatible for the From mail
  • Added Toastr for sending nice message instead of using alerts

= 1.9.5 (2023-06-20): =

  • Fix bug with sending emails

= 1.9.4 (2023-06-10): =

  • Fixed bug Fatal error on lists page when another plugin redeclare wp_mail()

= 1.9.3 (2023-04-08): =

  • Fixed Reply-to header. It's not overridden anymore

= 1.9.2 (2023-03-28): =

  • Added action for better dev experience in tracking error mailgun_error_track
  • Added header h:Sender

= 1.9.1 (2023-03-26): =

  • Remove not needed error logging.

  • Fixed bug with Override param for Woocommerce

  • = 1.9 (2023-01-18): =

  • Sanitizing and escaping vars. Possible security issues

= 1.8.10 (2022-12-26): =

  • Fixed bug with not overriding from name for Woocommerce

= 1.8.9 (2022-12-14): =

  • Fixed bug with removed wp_mail filter

= 1.8.8 (2022-12-11): =

  • Fixed bug when $to override in the wp_mail function

= 1.8.7 (2022-11-12): =

  • Fixed bug when field Override "From" Details was not updated

= 1.8.3 (2022-08-30): =

  • Plugin refactoring. Widget fixes for working with Legacy Widget Block. PHP8.0 support check

= 1.8.2 (2022-08-24): =

  • Plugin refactoring. Small fixes

= 1.8.1 (2022-08-19): =

  • backward compatibility with php7.0

= 1.8.0 (2022-08-18): =

  • Plugin refactoring. Using new languages constructions. Extended readme. Update version

= 1.7.9 (2021-05-24): =

  • API Key description

= 1.7.8 (2021-05-13): =

  • Tested WP 5.7.1

= 1.7.7 (2021-03-16): =

  • Updated assets, tested WP 5.7

= 1.7.6 (2021-02-19): =

  • Sync versions across plugin files

= 1.7.3 (2021-02-19): =

  • Update plugin version

= 1.7.2 (2020-10-07): =

  • Test plugin with PHP 7.4.
  • Test plugin up to WordPress 5.5.1.

= 1.7.1 (2019-02-07): =

  • Reinstall settings page for multisites.

= 1.7 (2019-01-21): =

  • Remove settings page for multisites.
  • Simplify admin notifications.
  • Test plugin with PHP 7.2.
  • Test plugin up to WordPress 5.0.3.

= 1.6.1 (2018-10-08): =

  • Restore Settings page form for all install types.

= 1.6 (2018-9-21): =

  • Refactor admin notifications
  • Enable Settings page for all WordPress install types
  • Enable Test Configuration for all WordPress install types
  • Test plugin up to WordPress 4.9.8.

= 1.5.14 (2018-09-11): =

  • Force SSL-secured SMTP connections to use port 465 (SMTPS) to connect, 587 for plain and TLS
  • Support region endpoint switching for SMTP

= 1.5.13.1 (2018-08-15): =

  • Fix line breaks in Test Configuration email

= 1.5.13 (2018-08-14): =

  • Default to US region if no region is configured in settings
  • Add admin notification about region configuration
  • Log an error message when an email is sent with no explicit region configured

= 1.5.12.3 (2018-08-09): =

  • Fix Region select menu default when wp-config.php variable is set
  • Fix front end email input validation

= 1.5.12.2 (2018-08-09): =

  • Fix plugin not saving after update

= 1.5.12.1 (2018-08-06): =

  • Fix for backwards compatibility

= 1.5.12 (2018-08-02): =

  • Add EU endpoint for Mailgun HTTP API
  • Fix broken logo image on Lists page
  • Test plugin up to Wordpress 4.9.7

= 1.5.11 (2018-05-30): =

  • Fix an issue with authentication failing for newer API keys
  • Test plugin up to Wordpress 4.9.6

= 1.5.10 (2017-11-22): =

  • Fix back to settings link on lists page (#65)
  • Fix a bug causing text/html emails to send as both text/plain and text/html parts

= 1.5.9 (2017-09-13): =

  • Add a configuration option to allow setting security type for SMTP connection (SSL / TLS)

= 1.5.8.5 (2017-09-05): =

  • Change default click tracking setting to htmlonly (#58)
  • Change PHPMailer set-up stanza to use TLS

= 1.5.8.4 (2017-06-28): =

= 1.5.8.3 (2017-06-13): =

= 1.5.8.2 (2017-02-27): =

  • Fix a bug causing empty tags to be sent with messages (#51)
  • Add mg_mutate_message_body hook to allow other plugins to modify the message body before send
  • Add mg_mutate_attachments hook to allow other plugins to modify the message attachments before send
  • Fix a bug causing the AJAX test to fail incorrectly.

= 1.5.8.2 (2017-02-27): =

  • Fix a bug causing empty tags to be sent with messages (#51)
  • Add mg_mutate_message_body hook to allow other plugins to modify the message body before send
  • Add mg_mutate_attachments hook 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_SMTP constant

= 1.5.7.1 (2017-01-18): =

  • Fix an odd Undefined property: MailgunAdmin::$defaults when saving config
  • Fix strict mode notice for using $mailgun['override-from'] without checking isset

= 1.5.7 (2017-01-04): =

= 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_notices code
  • 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_name not 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-Type processing 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 Lists admin 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. #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

wordpress-plugin's People

Contributors

alanef avatar andrejcremoznik avatar andrewminion-luminfire avatar bftrick avatar emersonbroga avatar fpcsjames avatar itsbhanusharma avatar matt-h avatar mauryaratan avatar michaellawton avatar oleksandr-mykhailenko avatar pirogoeth avatar rdiepenbrock avatar timiwahalahti avatar travelton avatar uavn avatar webspecnick avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

wordpress-plugin's Issues

FEATURE REQUEST: Let users disable override-from

My latest Quick Mail Plugin Release checks for Mailgun plugin.

Unfortunately, if override-from is enabled, I must subvert your plugin's behavior to let users send email with their own names.

It would be confusing to receive email from an unknown person's name.

Please add an option to let users disable this feature.

SMTP Security

Noticed that for SMTP, the SMTPSecure property that is used when choosing the secure option is SSL instead of tls and the port is 465 instead of 587. This seems to be older security standards for SMTPS. Why are you using older standards for SMTPS?

Also, wouldn't it be better to use the domain as the host so that the EHLO matches up with the account on MailGun and not the actual domain the site is running on?

https://github.com/mailgun/wordpress-plugin/blob/master/mailgun.php#L121

Undefined property: MailgunAdmin::$hook_suffix

This is a duplicate post from WordPress Support:
https://wordpress.org/support/topic/undefined-property-mailgunadminhook_suffix/

Referring to https://github.com/mailgun/wordpress-plugin/blob/master/includes/admin.php#L309, the hook_suffix will not be define, for example when WooCommerce Shop Manager logged into Dashboard. Shop Manager does not have access to manage_options , which will prevent defining the hook_suffix from line https://github.com/mailgun/wordpress-plugin/blob/master/includes/admin.php#L100.

I would suggest to add the if (current_user_can('manage_options')) at admin_notices function too.

The Git repo is being shipped with the plugin

For the past couple of versions (I think since 1.8.0), the Git repo (.git/) has been shipped with the plugin. My sites are version controlled, so when I update the plugin, I end up with odd warning messages in my IDE about an additional repo in a detached HEAD state. This seems, pretty clearly, like an oversight.
Here's the output of ls -a from the plugin directory in the current, public version of the plugin:

.git/
languages/        
includes/
.gitignore
CHANGELOG.md
LICENSE
mailgun.php
readme.txt
readme.md

Not working on WP 4.8

Fresh install of WP 4.8 using Docker image.

Where can I check the logs?

When click on Test configuration:

Mailgun HTTP API Test Failure; status "null"

Multipart email issue

Hey there!

We have some emails being sent from WooCommerce with the multipart/alternative content type (the "order processing" email in particular), but the Mailgun plugin seems to ignore that and send it as plaintext… which means that the email comes out looking like unrendered HTML.

I'm fixing this right now by just setting the email to send only as text/html, but it might be nice if the plugin supported multipart as well.

Thanks!

Europe Region not available

Because both API and SMTP option for the new Europe (EU) region require changes to the api or smtp URL, domains configured in the Europe region cannot be used with this plugin.

Make plugin WordPress VIP GO compatible

We are using this plugin in few of WP VIP GO project. There is one issue for this environt specific.

MU plugins which is default installed to every WP VIP GO project.
There is filter added which we have no control to remove and need to override from email with higher priority for all project to use custom from email.

This is only possible if there is limited from email address. We have scenario where we don't know what will be from email like in gravity form plugin notification we can set From email.

I have solution for this also in this PR.

Please let me know if you need any help.

Thanks.

Define MAILGUN_USEAPI as a required variable in the readme.

When using the WP-CONSTANTS defined in the readme I would recommend defining that the MAILGUN_USEAPI variable is required in order for the site settings to work by default via the API. This was an issue for me on a multisite installation where we were defining:

MAILGUN_APIKEY
MAILGUN_DOMAIN
MAILGUN_FROM_NAME
MAILGUN_FROM_ADDRESS

In the admin the use API defaults to yes so I expected the plugin functionality to do the same, however, when testing it appears that the variable needs to be defined beforehand.

One way to replicate this is to install and activate the plugin and set the same settings I provided earlier. On the Mailgun settings page if you hit test configuration you should get a failure message. If you click on save settings OR define the MAILGUN_USEAPI variable the test succeeds.

Cannot redeclare wp_mail(), WordPress 4.8.2

Mailgun Plugin: 1.5.8.5
WordPress: 4.8.2

Error:
PHP message: PHP Fatal error: Cannot redeclare wp_mail() (previously declared in .../wp-includes/pluggable.php:173) in .../plugins/mailgun/includes/wp-mail-api.php on line 414"

Might submit a PR, if time is found.

Got unknown Content-Type: multipart/alternative (revisited)

          Whilst this issue seems to have been resolved and handled, the PHP error being produced on line 316 of wp-mail-api.php still persists.

error_log('[mailgun] Got unknown Content-Type: ' . $content_type);

Can this be removed, assuming it is handled with the code that was added - or at least add a new else if ('multipart/alternative' === $content_type) option on line 314?

Originally posted by @devonto in #14 (comment)

Please keep supporting classic versions of WordPress

Currently working on a non-blocky version of WordPress (wp-cms), which doesn't contain block-related functions. There also is ClassicPress.

This issue is just to gently ask for your support by conditionally checking if the plugin is running on a "blocky" version of WP when using blocky stuff.

That way the plugin will keep working fine on WP-CMS and ClassicPress.

This is a fundamental plugin for the WP ecosystem, please don't leave non-blocky people behind.

Thanks.

Cannot test config on free plan

Keep getting "free accounts are for test purposes only" error on the test button while on free plan. Workaround is to upgrade to Unity plan 👎

Plug-in no longer honors the "wp_mail" filter, breaking functionality of other plug-ins.

By removing the call to apply_filters in your plugged wp_mail() override you are introducing a breaking change that causes other plug-ins to stop functioning as intended.

Not sure if this was intended to resolve the documented issue with the "$to" variable, but one unintended side-effect is that it also no longer filters any other message data as well, including headers, subject, and message body.

I've confirmed that the "Email Templates" plug-in ceases to function when "Mailgun" is active. Deactivating the plug-in resolves all underlying e-mail formatting issues.

GDPR Compliance

Currently the plugin is lacking compliance with GDPR (double opt in for list subscriptions, etc).
Is this plugin still maintained, is GDPR compliance on the roadmap, @pirogoeth ?

Multisite with multiple custom domain

If using multisite force me to use the constant in wp-config.php, how about sites that are using custom domain instead of the subdomain? Can we set its own config, thru option page?

1.8.5 release contains .git folder

not sure if i should report this here or elsewhere, but fyi:
https://wordpress.org/plugins/mailgun/https://downloads.wordpress.org/plugin/mailgun.1.8.5.zip

$ unzip mailgun.1.8.5.zip
Archive:  mailgun.1.8.5.zip
   creating: mailgun/
  inflating: mailgun/CHANGELOG.md
   creating: mailgun/.git/
   creating: mailgun/.git/branches/
  inflating: mailgun/.git/config
  inflating: mailgun/.git/description
 extracting: mailgun/.git/HEAD
   creating: mailgun/.git/hooks/
  inflating: mailgun/.git/hooks/applypatch-msg.sample
  inflating: mailgun/.git/hooks/commit-msg.sample
  inflating: mailgun/.git/hooks/fsmonitor-watchman.sample
  inflating: mailgun/.git/hooks/post-update.sample
  inflating: mailgun/.git/hooks/pre-applypatch.sample
  inflating: mailgun/.git/hooks/pre-commit.sample
  inflating: mailgun/.git/hooks/pre-merge-commit.sample
  inflating: mailgun/.git/hooks/prepare-commit-msg.sample
  inflating: mailgun/.git/hooks/pre-push.sample
  inflating: mailgun/.git/hooks/pre-rebase.sample
  inflating: mailgun/.git/hooks/pre-receive.sample
  inflating: mailgun/.git/hooks/update.sample
 extracting: mailgun/.gitignore
  inflating: mailgun/.git/index
   creating: mailgun/.git/info/
  inflating: mailgun/.git/info/exclude
   creating: mailgun/.git/logs/
  inflating: mailgun/.git/logs/HEAD
   creating: mailgun/.git/logs/refs/
   creating: mailgun/.git/logs/refs/heads/
  inflating: mailgun/.git/logs/refs/heads/master
   creating: mailgun/.git/logs/refs/remotes/
   creating: mailgun/.git/logs/refs/remotes/origin/
  inflating: mailgun/.git/logs/refs/remotes/origin/HEAD
   creating: mailgun/.git/objects/
   creating: mailgun/.git/objects/info/
   creating: mailgun/.git/objects/pack/
  inflating: mailgun/.git/objects/pack/pack-41676ee82b1b2babbdabe15c5f8b3aa3b7630e1f.idx
  inflating: mailgun/.git/objects/pack/pack-41676ee82b1b2babbdabe15c5f8b3aa3b7630e1f.pack
  inflating: mailgun/.git/packed-refs
   creating: mailgun/.git/refs/
   creating: mailgun/.git/refs/heads/
 extracting: mailgun/.git/refs/heads/master
   creating: mailgun/.git/refs/remotes/
   creating: mailgun/.git/refs/remotes/origin/
 extracting: mailgun/.git/refs/remotes/origin/HEAD
   creating: mailgun/.git/refs/tags/
...

Version should adhere to Semver rules

Current version is 1.5.8.5. This is problematic because tools like Composer rely on semantic versioning when looking up dependencies. I don't know what could possible be the reason for this version number, but I'd like to urge you to drop the 4th digit and adhere to Semver rules.

Semver: https://semver.org/

Update tag to 1.7.1

Can the git tags please be kept up to date? Code is at version 1.7.1 but tag is still at 1.5.13. Thanks!

Broken update process

Hey, guys!

Why did you rename the bootstrap file from mailgun.php to Mailgun.php? This breaks the update process: WordPress thinks the original plugin no longer exists and it disables it by default. I see there are only 4 hours since you released the update. Maybe if you're quick enough and rename the file back to mailgun.php you won't bring down 30.000 websites.

Best regards,
Eusebiu Oprinoiu

Undefined index: o:tag includes/wp-mail.php on line 154

Notice: Undefined index: o:tag in /plugins/mailgun/includes/wp-mail.php on line 154

Change line 135 to:

$body = array(
    'from' => "{$from_name} <{$from_email}>",
    'to' => $to,
    'subject' => $subject,
    'text' => $message,
    'o:tag' => ''
);

Problem when coma in Sender name

If there is a coma in the sender name, only the second part of the name is used/displayed
Can you reproduce this ? I don't have the issue with another SMTP plugin (Postman SMTP)

Also, please update your plugin on wordpress repo (version compatibiliy). Or remove it.
That's really not serious..

Attachment Handling

Attachments are not handled properly in version 1.0. Ignoring the double-loop syntax issue that exists in the current code... A bigger issue exists. wp_remote_post() cannot handle file streams, as a result, any files you pass to it are dropped.

Need to find an alternate method for transmitting files via POST.

Version 1.6 did not confirm in Dashboard the value defined in wp-config.php

After we set the value in wp-config.php, the plugin option page didn't show the value for verification and confirmation.

Would love if the option page can display back the value defined in wp-config.php.

Furthermore, some of the constants are optional, so would love to be noted within the instructions in option page.

wp_mail() : $to parameter being erased by extract()

PHP version : 7.4
Wordpress version : 6.1.1
Plugin version : 1.8.7

Using Mailgun API.

This error occurred since novembre 8th (or so) since then no email is sent by the website.

After checking mailgun logs, server logs and everything I could error_logging every step of the wp_mail() function of this plugin it turns out that the issue sent by mailgun API is that the "to" parameter is missing from the request. It's actually an empty array that is sent...

It seems that the apply_filters() on wp-mail-api.php line 116 isn't returning what it's supposed to and the extract() line 120 php function is overriding the $to parameter. I can't figure out why this appends.

Until a bug fix is published I commented the lines 116 to 120 of the wp-mail-api.php. It seems to work fine without it for now.

Thanks you for your work and support !

Fatal error on lists page when another plugin redeclares wp_mail()

When you activate the Mailgun plugin alongside any other plugin which attempts to override wp_mail(), there's a fatal error on the Settings -> Mailgun Lists page:

Fatal error: Uncaught Error: Call to undefined function mg_api_get_region() in /Users/nathan/Local Sites/mailgun/app/public/wp-content/plugins/mailgun/mailgun.php:221

The line in question is part of the api_call() method.

mg_api_get_region() is declared within mg-filter.php but it's possible to end up in a situation where that file is never loaded.

From the main plugin file, starting on line 83:

if ($this->get_option('useAPI') || (defined('MAILGUN_USEAPI') && MAILGUN_USEAPI)) {
    if (!function_exists('wp_mail')) {
        if (!include __DIR__ . '/includes/wp-mail-api.php') {
            $this->deactivate_and_die(__DIR__ . '/includes/wp-mail-api.php');
        }
    }
} else {

If wp_mail() is declared elsewhere, wp-mail-api.php and in turn mg-filter.php aren't included.

This means the plugin is able to operate in a half loaded state where it's relying on functions that aren't available.

Steps to reproduce:

  1. Setup a blank WordPress install
  2. Install and activate the Mailgun plugin
  3. Install and activate a barebones plugin which redeclares wp_mail(). I've included code below. Note that order is important. The plugin has to load BEFORE Mailgun and since they're loaded alphabetically by file/folder name, use something like abc.php

Barebones plugin code:

<?php
/**
 * Plugin Name: WP Mail Test
 * Version: 1.0.0
 */

if (!function_exists('wp_mail')) {
    function wp_mail() {
        return false;
    }
}

Version declaration missmatch

The readme.txt is showing the plugin's stable (latest) version as 1.9.5.

This Git repo and WordPress's SVN are showing the latest tag as 1.9.6 (https://plugins.trac.wordpress.org/browser/mailgun/tags).

We've noticed this as we load the Mailgun plugin via Composer/WPackagist. Which is based on the SVN tags.

Running wpcli plugin list shows this issue too as it returns:

+-----------------------------+----------+------------------------------+---------+
| name                        | status   | update                       | version |
+-----------------------------+----------+------------------------------+---------+
| mailgun                     | inactive | version higher than expected | 1.9.6   |
+-----------------------------+----------+------------------------------+---------+

Expected behaviour:

readme.txt and SVN tags to be the same.

Empty tag added to headers

If the user doesn’t specify a tag in the configuration page, Mailgun creates a single tag with an empty string value, instead of leaving the tags array empty. This causes problems when you need to allow users to unsubscribe based on X-Mailgun-Tag headers that have been programatically added outside of the plugin.

It doesn’t look as if the current behaviour is intended. The following fixes the problem in v1.5.8.1 of the plugin (includes/wp-mail-api.php):

Line 229, change this:

$body['o:tag'] = '';

to this:

$body['o:tag'] = array();

and on line 240, change this:

if (isset($mailgun['campaign-id'])) {

to this:

if (!empty($mailgun['campaign-id'])) {


Source: https://wordpress.org/support/topic/comment-notification-email-are-not-being-sent/

plugin was deactived for two nights in a row now

Plugin was deactivated automagicaly for two nights in a row now by my wordpress install.

backend shows message: plugin is deactivated because a file is missing.

(btw: it is annoying to say the least that your change-log is empty. Please keep this updated with stuff that has been done for that release. )

WordPress 4.7
WooCommerce 2.6.9
1.5.1

Improve error message when admin email not set and test configuration used

I have just set up mailgun on a new site im building.

The admin email is still set to [email protected].

When I set up the Mailgun plugin to use API, click Save, then Test Changes, I get this error popup:

Mailgun HTTP API Test Failure; status "'to' parameter is not a valid address. please check documentation"

I was bright enough to figure it out but not before I had scanned up and down the page twice looking for this to parameter.

I think you should special case this API reply to give the admin a hint as to what is wrong.

Probably an incorrect error logic in wp_mail function

I'm not sure if this is a bug or not. But while I am looking through your code, I noticed that the condition in this if-clause at line 387 in wp-mail-api.php could be invalid. I think the && should be || instead, because either of the conditions:

  • response code not equal to 200
  • response body's message not set

should trigger an error.

    // Mailgun API should *always* return a `message` field, even when
    // $response_code != 200, so a lack of `message` indicates something
    // is broken.
    if ((int) $response_code != 200 && !isset($response_body->message)) {
        // Store response code and HTTP response message in last error.
        $response_message = wp_remote_retrieve_response_message($response);
        $errmsg = "$response_code - $response_message";
        mg_api_last_error($errmsg);
        return false;
    }

Thanks
inwwin

Undefined variable: from_name on every email process

Keep getting this error in my log. thing is, it never happen on my development server :( Both using WooCommerce. But the email reached Mailgun server.

2017/02/03 01:01:01 [error] 21551#21551: *13767 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined variable: from_name in /app/plugins/mailgun/includes/wp-mail-api.php on line 206 PHP message: PHP Notice: Undefined variable: from_email in /app/plugins/mailgun/includes/wp-mail-api.php on line 207" while reading response header from upstream, client: x.x.x.x, server: thesbx.com, request: "GET /core/wp-admin/admin-ajax.php?action=mailgun-test&_wpnonce=0112a12f84 HTTP/1.1", upstream: "fastcgi://unix:/run/php/php7.0-fpm.sock:", host: "website.com", referrer: "https://website.com/core/wp-admin/options-general.php?page=mailgun"

Latest plugin silently breaks if configured using constants due to non-documented region requirement

The latest plugin version published to WordPress.org but not GitHub (versions 1.5.12 and 1.5.12.1) break compatibility with those using wp-config.php to configure the plugin. The latest versions include the ability to specify the region to connect to (yay!) but if the region is not set in the database or, via wp-config.php and the undocumented-on-GitHub MAILGUN_REGION constant, sending mail will fail. There were no errors in the logs, the only way I was able to find an error was attempting to reset my password which generated the following error:

The email could not be sent.
Possible reason: your host may have disabled the mail() function.

The quick fix for those seeking one is to define the following constant in your wp-config.php:

define('MAILGUN_REGION', 'us');

eu and us are accepted values.

Mailgun, it would be great if you could:

  1. Ensure the latest plugin versions are published here to GitHub before being published on WordPress.org so that the community can test for these kinds of issues.
  2. Define a default region if none is set. Alternatively, document the new required constant and use error_log to notify the user it must be set if it is not already.

New update causes site wide fatal errors.

Errors include:

AH01071: Got error 'PHP message: PHP Parse error: syntax error, unexpected '?', expecting variable (T_VARIABLE) in [...]/public_html/wp-content/plugins/__mailgun/mailgun.php on line 109\n', referer: https://www.pegcitycarcoop.ca/wp-admin/plugins.php?plugin=__mailgun%2Fmailgun.php

AH01071: Got error 'PHP message: PHP Fatal error: Uncaught TypeError: Return value of Mailgun::load_list_widget() must be an instance of void, none returned in [...]/public_html/wp-content/plugins/mailgun/mailgun.php:498

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.