diff --git a/CHANGELOG.md b/CHANGELOG.md index 0724fa8..e013b7e 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,9 @@ Changelog ========= +2.1.9 (2025-06-24) +- Added fallback option. Merge PR for widget + 2.1.8 (2025-05-11) - Just keep update WP version. And tested compatibility with it diff --git a/includes/options-page.php b/includes/options-page.php index 5573ed2..3d27097 100755 --- a/includes/options-page.php +++ b/includes/options-page.php @@ -60,6 +60,13 @@ $trackOpens = ( defined('MAILGUN_TRACK_OPENS') ? MAILGUN_TRACK_OPENS : null ); $suppressClicks = $this->get_option('suppress_clicks') ?: 'no'; +$emailFallback = $this->get_option('email_fallback') ?: 'no'; + +$settings = []; +try { + $settings = $mailgun->getTrackingSettings(); +} catch (Throwable $e) { +} ?>
@@ -116,6 +123,24 @@ + + + + + + + + + +
+
    +
  • + Click tracking +
  • +
  • + Open tracking +
  • +
  • + Unsubscribes +
  • +
+
@@ -431,6 +456,18 @@ class="regular-text"

+
+
+ +

diff --git a/includes/wp-mail-api.php b/includes/wp-mail-api.php index 5c0f38d..2d910a1 100644 --- a/includes/wp-mail-api.php +++ b/includes/wp-mail-api.php @@ -495,8 +495,8 @@ function wp_mail( $to, $subject, $message, $headers = '', $attachments = array() } // Email Fallback - - if ($isFallbackNeeded) { + $isFallbackEnabled = get_option('email_fallback') ?: 'no'; + if ($isFallbackNeeded && $isFallbackEnabled === 'yes') { global $phpmailer; // (Re)create it, if it's gone missing. diff --git a/mailgun.php b/mailgun.php index 1173324..6bc65b4 100755 --- a/mailgun.php +++ b/mailgun.php @@ -3,7 +3,7 @@ * Plugin Name: Mailgun * Plugin URI: http://wordpress.org/extend/plugins/mailgun/ * Description: Mailgun integration for WordPress - * Version: 2.1.8 + * Version: 2.1.9 * Requires PHP: 7.4 * Requires at least: 4.4 * Author: Mailgun @@ -294,6 +294,21 @@ public function get_lists(): array { return $results; } + /** + * @return array + * @throws JsonException + */ + public function getTrackingSettings(): array + { + $domain = ( defined( 'MAILGUN_DOMAIN' ) && MAILGUN_DOMAIN ) ? MAILGUN_DOMAIN : $this->get_option( 'domain' ); + if (!$domain) { + return []; + } + $settings = $this->api_call(sprintf("domains/%s/tracking", $domain), [], 'GET' ); + + return json_decode( $settings, true, 512, JSON_THROW_ON_ERROR ); + } + /** * Handle add list ajax post. * @@ -384,17 +399,18 @@ public function list_form( string $list_address, array $args = array() ): void {

- Name: - + +

- Email: - + +

- '1' ) : ?> +
+ '1' ) : ?>