Version Description
(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
Download this release
Release Info
Developer | Mailgun |
Plugin | Mailgun for WordPress |
Version | 1.5.14 |
Comparing to | |
See all releases |
Code changes from version 1.5.13.1 to 1.5.14
- CHANGELOG.md +3 -0
- includes/admin.php +4 -4
- includes/mg-filter.php +25 -10
- includes/wp-mail-api.php +1 -1
- mailgun.php +18 -5
- readme.txt +6 -2
CHANGELOG.md
CHANGED
@@ -1,6 +1,9 @@
|
|
1 |
Changelog
|
2 |
=========
|
3 |
|
|
|
|
|
|
|
4 |
|
5 |
1.5.13.1 (2018-08-15)
|
6 |
- Fix line breaks in Test Configuration email
|
1 |
Changelog
|
2 |
=========
|
3 |
|
4 |
+
1.5.14 (2018-09-11):
|
5 |
+
- Force SSL-secured SMTP connections to use port 465 (SMTPS) to connect, 587 for plain and TLS
|
6 |
+
- Support region endpoint switching for SMTP
|
7 |
|
8 |
1.5.13.1 (2018-08-15)
|
9 |
- Fix line breaks in Test Configuration email
|
includes/admin.php
CHANGED
@@ -362,9 +362,9 @@ class MailgunAdmin extends Mailgun
|
|
362 |
<div id='mailgun-warning' class='notice notice-warning fade'>
|
363 |
<p>
|
364 |
<strong>
|
365 |
-
<?php _e('Mailgun
|
366 |
</strong>
|
367 |
-
<?php printf(__('
|
368 |
</p>
|
369 |
</div>
|
370 |
<?php
|
@@ -433,9 +433,9 @@ class MailgunAdmin extends Mailgun
|
|
433 |
if ((bool) $useAPI) {
|
434 |
$method = __('HTTP API', 'mailgun');
|
435 |
} else {
|
436 |
-
$method = ((bool) $secure) ? __('Secure SMTP', 'mailgun') : __('SMTP', 'mailgun');
|
437 |
if ((bool) $secure) {
|
438 |
-
$method = $method . sprintf(__(' via %s', $sectype)
|
439 |
}
|
440 |
}
|
441 |
|
362 |
<div id='mailgun-warning' class='notice notice-warning fade'>
|
363 |
<p>
|
364 |
<strong>
|
365 |
+
<?php _e('Mailgun now supports multiple regions! ', 'mailgun'); ?>
|
366 |
</strong>
|
367 |
+
<?php printf(__('By default, we will use the US region, but we now have an EU region generally available. You can change regions <a href="%1$s">here</a>.', 'mailgun'), menu_page_url('mailgun', false)); ?>
|
368 |
</p>
|
369 |
</div>
|
370 |
<?php
|
433 |
if ((bool) $useAPI) {
|
434 |
$method = __('HTTP API', 'mailgun');
|
435 |
} else {
|
436 |
+
$method = ((bool) $secure) ? __('Secure SMTP', 'mailgun') : __('Insecure SMTP', 'mailgun');
|
437 |
if ((bool) $secure) {
|
438 |
+
$method = $method . sprintf(__(' via %s', 'mailgun'), $sectype);
|
439 |
}
|
440 |
}
|
441 |
|
includes/mg-filter.php
CHANGED
@@ -295,15 +295,30 @@ function mg_dump_headers($headers = null)
|
|
295 |
*
|
296 |
* @since 1.5.12
|
297 |
*/
|
298 |
-
function
|
299 |
{
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
}
|
307 |
|
308 |
-
|
309 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
295 |
*
|
296 |
* @since 1.5.12
|
297 |
*/
|
298 |
+
function mg_api_get_region($getRegion)
|
299 |
{
|
300 |
+
switch ($getRegion) {
|
301 |
+
case 'us': return 'https://api.mailgun.net/v3/';
|
302 |
+
case 'eu': return 'https://api.eu.mailgun.net/v3/';
|
303 |
+
default: return false;
|
304 |
+
}
|
305 |
+
}
|
|
|
306 |
|
307 |
+
/**
|
308 |
+
* Set the SMTP endpoint based on the region selected.
|
309 |
+
* Value can be "0" if not selected, "us" or "eu"
|
310 |
+
*
|
311 |
+
* @param string $getRegion Region value set either in config or Mailgun plugin settings.
|
312 |
+
*
|
313 |
+
* @return bool|string
|
314 |
+
*
|
315 |
+
* @since 1.5.12
|
316 |
+
*/
|
317 |
+
function mg_smtp_get_region($getRegion)
|
318 |
+
{
|
319 |
+
switch ($getRegion) {
|
320 |
+
case 'us': return 'smtp.mailgun.org';
|
321 |
+
case 'eu': return 'smtp.eu.mailgun.org';
|
322 |
+
default: return false;
|
323 |
+
}
|
324 |
+
}
|
includes/wp-mail-api.php
CHANGED
@@ -364,7 +364,7 @@ function wp_mail($to, $subject, $message, $headers = '', $attachments = array())
|
|
364 |
),
|
365 |
);
|
366 |
|
367 |
-
$endpoint =
|
368 |
$endpoint = ($endpoint) ? $endpoint : 'https://api.mailgun.net/v3/';
|
369 |
$url = $endpoint."{$domain}/messages";
|
370 |
|
364 |
),
|
365 |
);
|
366 |
|
367 |
+
$endpoint = mg_api_get_region($region);
|
368 |
$endpoint = ($endpoint) ? $endpoint : 'https://api.mailgun.net/v3/';
|
369 |
$url = $endpoint."{$domain}/messages";
|
370 |
|
mailgun.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
* Plugin Name: Mailgun
|
5 |
* Plugin URI: http://wordpress.org/extend/plugins/mailgun/
|
6 |
* Description: Mailgun integration for WordPress
|
7 |
-
* Version: 1.5.
|
8 |
* Author: Mailgun
|
9 |
* Author URI: http://www.mailgun.com/
|
10 |
* License: GPLv2 or later
|
@@ -115,18 +115,31 @@ class Mailgun
|
|
115 |
$secure = (defined('MAILGUN_SECURE') && MAILGUN_SECURE) ? MAILGUN_SECURE : $this->get_option('secure');
|
116 |
$sectype = (defined('MAILGUN_SECTYPE') && MAILGUN_SECTYPE) ? MAILGUN_SECTYPE : $this->get_option('sectype');
|
117 |
$password = (defined('MAILGUN_PASSWORD') && MAILGUN_PASSWORD) ? MAILGUN_PASSWORD : $this->get_option('password');
|
|
|
|
|
|
|
|
|
118 |
|
119 |
$phpmailer->Mailer = 'smtp';
|
120 |
-
$phpmailer->Host =
|
121 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
122 |
$phpmailer->SMTPAuth = true;
|
123 |
$phpmailer->Username = $username;
|
124 |
$phpmailer->Password = $password;
|
125 |
|
126 |
-
$phpmailer->SMTPSecure = (bool) $secure ? $sectype : '
|
127 |
// Without this line... wp_mail for SMTP-only will always return false. But why? :(
|
128 |
$phpmailer->Debugoutput = 'mg_smtp_debug_output';
|
129 |
$phpmailer->SMTPDebug = 2;
|
|
|
|
|
|
|
130 |
}
|
131 |
|
132 |
/**
|
@@ -168,7 +181,7 @@ class Mailgun
|
|
168 |
$apiKey = (defined('MAILGUN_APIKEY') && MAILGUN_APIKEY) ? MAILGUN_APIKEY : $options['apiKey'];
|
169 |
$domain = (defined('MAILGUN_DOMAIN') && MAILGUN_DOMAIN) ? MAILGUN_DOMAIN : $options['domain'];
|
170 |
|
171 |
-
$region =
|
172 |
$this->api_endpoint = ($region) ? $region : 'https://api.mailgun.net/v3/';
|
173 |
|
174 |
$time = time();
|
4 |
* Plugin Name: Mailgun
|
5 |
* Plugin URI: http://wordpress.org/extend/plugins/mailgun/
|
6 |
* Description: Mailgun integration for WordPress
|
7 |
+
* Version: 1.5.14
|
8 |
* Author: Mailgun
|
9 |
* Author URI: http://www.mailgun.com/
|
10 |
* License: GPLv2 or later
|
115 |
$secure = (defined('MAILGUN_SECURE') && MAILGUN_SECURE) ? MAILGUN_SECURE : $this->get_option('secure');
|
116 |
$sectype = (defined('MAILGUN_SECTYPE') && MAILGUN_SECTYPE) ? MAILGUN_SECTYPE : $this->get_option('sectype');
|
117 |
$password = (defined('MAILGUN_PASSWORD') && MAILGUN_PASSWORD) ? MAILGUN_PASSWORD : $this->get_option('password');
|
118 |
+
$region = (defined('MAILGUN_REGION') && MAILGUN_REGION) ? MAILGUN_REGION : $this->get_option('region');
|
119 |
+
|
120 |
+
$smtp_endpoint = mg_smtp_get_region($region);
|
121 |
+
$smtp_endpoint = (bool) $smtp_endpoint ? $smtp_endpoint : 'smtp.mailgun.org';
|
122 |
|
123 |
$phpmailer->Mailer = 'smtp';
|
124 |
+
$phpmailer->Host = $smtp_endpoint;
|
125 |
+
if ( 'ssl' === $sectype ) {
|
126 |
+
// For SSL-only connections, use 465
|
127 |
+
$phpmailer->Port = 465;
|
128 |
+
} else {
|
129 |
+
// Otherwise, use 587.
|
130 |
+
$phpmailer->Port = 587;
|
131 |
+
}
|
132 |
$phpmailer->SMTPAuth = true;
|
133 |
$phpmailer->Username = $username;
|
134 |
$phpmailer->Password = $password;
|
135 |
|
136 |
+
$phpmailer->SMTPSecure = (bool) $secure ? $sectype : '';
|
137 |
// Without this line... wp_mail for SMTP-only will always return false. But why? :(
|
138 |
$phpmailer->Debugoutput = 'mg_smtp_debug_output';
|
139 |
$phpmailer->SMTPDebug = 2;
|
140 |
+
|
141 |
+
// Emit some logging for SMTP connection
|
142 |
+
mg_smtp_debug_output(sprintf("PHPMailer configured to send via %s:%s", $phpmailer->Host, $phpmailer->Port), 'DEBUG');
|
143 |
}
|
144 |
|
145 |
/**
|
181 |
$apiKey = (defined('MAILGUN_APIKEY') && MAILGUN_APIKEY) ? MAILGUN_APIKEY : $options['apiKey'];
|
182 |
$domain = (defined('MAILGUN_DOMAIN') && MAILGUN_DOMAIN) ? MAILGUN_DOMAIN : $options['domain'];
|
183 |
|
184 |
+
$region = mg_api_get_region($getRegion);
|
185 |
$this->api_endpoint = ($region) ? $region : 'https://api.mailgun.net/v3/';
|
186 |
|
187 |
$time = time();
|
readme.txt
CHANGED
@@ -5,7 +5,7 @@ Contributors: Mailgun, sivel, lookahead.io, m35dev
|
|
5 |
Tags: mailgun, smtp, http, api, mail, email
|
6 |
Requires at least: 3.3
|
7 |
Tested up to: 4.9.8
|
8 |
-
Stable tag: 1.5.
|
9 |
License: GPLv2 or later
|
10 |
|
11 |
|
@@ -128,7 +128,11 @@ MAILGUN_FROM_ADDRESS Type: string
|
|
128 |
|
129 |
== Changelog ==
|
130 |
|
131 |
-
= 1.5.
|
|
|
|
|
|
|
|
|
132 |
- Fix line breaks in Test Configuration email
|
133 |
|
134 |
= 1.5.13 (2018-08-14): =
|
5 |
Tags: mailgun, smtp, http, api, mail, email
|
6 |
Requires at least: 3.3
|
7 |
Tested up to: 4.9.8
|
8 |
+
Stable tag: 1.5.14
|
9 |
License: GPLv2 or later
|
10 |
|
11 |
|
128 |
|
129 |
== Changelog ==
|
130 |
|
131 |
+
= 1.5.14 (2018-09-11): =
|
132 |
+
- Force SSL-secured SMTP connections to use port 465 (SMTPS) to connect, 587 for plain and TLS
|
133 |
+
- Support region endpoint switching for SMTP
|
134 |
+
|
135 |
+
= 1.5.13.1 (2018-08-15): =
|
136 |
- Fix line breaks in Test Configuration email
|
137 |
|
138 |
= 1.5.13 (2018-08-14): =
|