Version Description
- 2018-02-05 =
- Fixed:
Return pathcan't be turned off. - Fixed:
Authenticationsometimes can't be turned off. - Fixed:
Auto TLSsometimes can't be turned off. - Fixed: BCC support for Gmail was broken.
- Fixed: Debug output improved to handle SELinux and grsecurity.
- Fixed: Strip slashes from plugin settings (useful for
From Nameoption). - Fixed: Change the way sanitization is done to prevent accidental removal of useful data.
- Fixed: Plugin activation will not overwrite settings back to defaults.
- Fixed: Properly set
Auto TLSoption on plugin activation. - Fixed: Providers autoloading improved for certain Windows-based installs.
- Fixed: Use the proper path to load translations from plugin's
/languagesdirectory. - Changed: Do not autoload on each page request plugin settings from WordPress options table.
- Changed: Do not autoload Pepipost classes unless it's saved as active mailer in settings.
Download this release
Release Info
| Developer | slaFFik |
| Plugin | |
| Version | 1.2.5 |
| Comparing to | |
| See all releases | |
Code changes from version 1.2.3 to 1.2.5
- languages/wp-mail-smtp.pot +6 -6
- readme.txt +18 -0
- src/Admin/Pages/Settings.php +12 -7
- src/Admin/Pages/Test.php +2 -2
- src/Core.php +10 -8
- src/MailCatcher.php +3 -0
- src/Options.php +17 -6
- src/Providers/Gmail/Mailer.php +6 -0
- src/Providers/Loader.php +12 -6
- src/Providers/Mail/Mailer.php +6 -0
- src/Providers/MailerAbstract.php +8 -2
- src/Providers/Mailgun/Mailer.php +1 -1
- src/Providers/OptionsAbstract.php +2 -2
- src/Providers/Sendgrid/Mailer.php +1 -1
- wp_mail_smtp.php +2 -2
languages/wp-mail-smtp.pot
CHANGED
|
@@ -86,15 +86,15 @@ msgstr ""
|
|
| 86 |
msgid "Looking for high inbox delivery? Try Pepipost with easy setup and free emails. Learn more %1$shere%2$s."
|
| 87 |
msgstr ""
|
| 88 |
|
| 89 |
-
#: wp_mail_smtp.php:371, wp_mail_smtp.php:376, src/Admin/Pages/Settings.php:
|
| 90 |
msgid "Return Path"
|
| 91 |
msgstr ""
|
| 92 |
|
| 93 |
-
#: wp_mail_smtp.php:381, src/Admin/Pages/Settings.php:
|
| 94 |
msgid "Set the return-path to match the From Email"
|
| 95 |
msgstr ""
|
| 96 |
|
| 97 |
-
#: wp_mail_smtp.php:385, src/Admin/Pages/Settings.php:
|
| 98 |
msgid "Return Path indicates where non-delivery receipts - or bounce messages - are to be sent."
|
| 99 |
msgstr ""
|
| 100 |
|
|
@@ -286,11 +286,11 @@ msgstr ""
|
|
| 286 |
msgid "General"
|
| 287 |
msgstr ""
|
| 288 |
|
| 289 |
-
#: src/Admin/Pages/Misc.php:67, src/Admin/Pages/Settings.php:
|
| 290 |
msgid "Save Settings"
|
| 291 |
msgstr ""
|
| 292 |
|
| 293 |
-
#: src/Admin/Pages/Misc.php:95, src/Admin/Pages/Settings.php:
|
| 294 |
msgid "Settings were successfully saved."
|
| 295 |
msgstr ""
|
| 296 |
|
|
@@ -318,7 +318,7 @@ msgstr ""
|
|
| 318 |
msgid "If you leave this blank, the emails will be sent from %s."
|
| 319 |
msgstr ""
|
| 320 |
|
| 321 |
-
#: src/Admin/Pages/Settings.php:
|
| 322 |
msgid "If unchecked bounce messages may be lost."
|
| 323 |
msgstr ""
|
| 324 |
|
| 86 |
msgid "Looking for high inbox delivery? Try Pepipost with easy setup and free emails. Learn more %1$shere%2$s."
|
| 87 |
msgstr ""
|
| 88 |
|
| 89 |
+
#: wp_mail_smtp.php:371, wp_mail_smtp.php:376, src/Admin/Pages/Settings.php:142
|
| 90 |
msgid "Return Path"
|
| 91 |
msgstr ""
|
| 92 |
|
| 93 |
+
#: wp_mail_smtp.php:381, src/Admin/Pages/Settings.php:151
|
| 94 |
msgid "Set the return-path to match the From Email"
|
| 95 |
msgstr ""
|
| 96 |
|
| 97 |
+
#: wp_mail_smtp.php:385, src/Admin/Pages/Settings.php:154
|
| 98 |
msgid "Return Path indicates where non-delivery receipts - or bounce messages - are to be sent."
|
| 99 |
msgstr ""
|
| 100 |
|
| 286 |
msgid "General"
|
| 287 |
msgstr ""
|
| 288 |
|
| 289 |
+
#: src/Admin/Pages/Misc.php:67, src/Admin/Pages/Settings.php:185
|
| 290 |
msgid "Save Settings"
|
| 291 |
msgstr ""
|
| 292 |
|
| 293 |
+
#: src/Admin/Pages/Misc.php:95, src/Admin/Pages/Settings.php:251
|
| 294 |
msgid "Settings were successfully saved."
|
| 295 |
msgstr ""
|
| 296 |
|
| 318 |
msgid "If you leave this blank, the emails will be sent from %s."
|
| 319 |
msgstr ""
|
| 320 |
|
| 321 |
+
#: src/Admin/Pages/Settings.php:155
|
| 322 |
msgid "If unchecked bounce messages may be lost."
|
| 323 |
msgstr ""
|
| 324 |
|
readme.txt
CHANGED
|
@@ -146,6 +146,24 @@ By all means please contact us to discuss features or options you'd like to see
|
|
| 146 |
|
| 147 |
== Changelog ==
|
| 148 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 149 |
= 1.2.3 - 2018-01-22 =
|
| 150 |
* Fixed: Gmail tokens were reset after clicking Save Settings.
|
| 151 |
* Fixed: Slight typo in Gmail success message.
|
| 146 |
|
| 147 |
== Changelog ==
|
| 148 |
|
| 149 |
+
= 1.2.5 - 2018-02-05 =
|
| 150 |
+
* Fixed: `Return path` can't be turned off.
|
| 151 |
+
* Fixed: `Authentication` sometimes can't be turned off.
|
| 152 |
+
* Fixed: `Auto TLS` sometimes can't be turned off.
|
| 153 |
+
* Fixed: BCC support for Gmail was broken.
|
| 154 |
+
* Fixed: Debug output improved to handle SELinux and grsecurity.
|
| 155 |
+
* Fixed: Strip slashes from plugin settings (useful for `From Name` option).
|
| 156 |
+
* Fixed: Change the way sanitization is done to prevent accidental removal of useful data.
|
| 157 |
+
* Fixed: Plugin activation will not overwrite settings back to defaults.
|
| 158 |
+
* Fixed: Properly set `Auto TLS` option on plugin activation.
|
| 159 |
+
* Fixed: Providers autoloading improved for certain Windows-based installs.
|
| 160 |
+
* Fixed: Use the proper path to load translations from plugin's `/languages` directory.
|
| 161 |
+
* Changed: Do not autoload on each page request plugin settings from WordPress options table.
|
| 162 |
+
* Changed: Do not autoload Pepipost classes unless it's saved as active mailer in settings.
|
| 163 |
+
|
| 164 |
+
= 1.2.4 - 2018-01-28 =
|
| 165 |
+
* Fixed: Improved escaping in debug reporting.
|
| 166 |
+
|
| 167 |
= 1.2.3 - 2018-01-22 =
|
| 168 |
* Fixed: Gmail tokens were reset after clicking Save Settings.
|
| 169 |
* Fixed: Slight typo in Gmail success message.
|
src/Admin/Pages/Settings.php
CHANGED
|
@@ -113,12 +113,6 @@ class Settings extends PageAbstract {
|
|
| 113 |
|
| 114 |
<?php foreach ( wp_mail_smtp()->get_providers()->get_options_all() as $provider ) : ?>
|
| 115 |
|
| 116 |
-
<?php
|
| 117 |
-
if ( ! $options->is_pepipost_active() && $provider->get_slug() === 'pepipost' ) {
|
| 118 |
-
continue;
|
| 119 |
-
}
|
| 120 |
-
?>
|
| 121 |
-
|
| 122 |
<div class="wp-mail-smtp-mailer <?php echo $mailer === $provider->get_slug() ? 'active' : ''; ?>">
|
| 123 |
<div class="wp-mail-smtp-mailer-image">
|
| 124 |
<img src="<?php echo esc_url( $provider->get_logo_url() ); ?>"
|
|
@@ -149,7 +143,7 @@ class Settings extends PageAbstract {
|
|
| 149 |
</div>
|
| 150 |
<div class="wp-mail-smtp-setting-field">
|
| 151 |
<input name="wp-mail-smtp[mail][return_path]" type="checkbox"
|
| 152 |
-
value="true" <?php checked( true, $options->get( 'mail', 'return_path' ) ); ?>
|
| 153 |
<?php echo $options->is_const_defined( 'mail', 'return_path' ) ? 'disabled' : ''; ?>
|
| 154 |
id="wp-mail-smtp-setting-return_path"
|
| 155 |
/>
|
|
@@ -206,6 +200,17 @@ class Settings extends PageAbstract {
|
|
| 206 |
$options = new Options();
|
| 207 |
$old_opt = $options->get_all();
|
| 208 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 209 |
// Remove all debug messages when switching mailers.
|
| 210 |
if ( $old_opt['mail']['mailer'] !== $data['mail']['mailer'] ) {
|
| 211 |
Debug::clear();
|
| 113 |
|
| 114 |
<?php foreach ( wp_mail_smtp()->get_providers()->get_options_all() as $provider ) : ?>
|
| 115 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 116 |
<div class="wp-mail-smtp-mailer <?php echo $mailer === $provider->get_slug() ? 'active' : ''; ?>">
|
| 117 |
<div class="wp-mail-smtp-mailer-image">
|
| 118 |
<img src="<?php echo esc_url( $provider->get_logo_url() ); ?>"
|
| 143 |
</div>
|
| 144 |
<div class="wp-mail-smtp-setting-field">
|
| 145 |
<input name="wp-mail-smtp[mail][return_path]" type="checkbox"
|
| 146 |
+
value="true" <?php checked( true, (bool) $options->get( 'mail', 'return_path' ) ); ?>
|
| 147 |
<?php echo $options->is_const_defined( 'mail', 'return_path' ) ? 'disabled' : ''; ?>
|
| 148 |
id="wp-mail-smtp-setting-return_path"
|
| 149 |
/>
|
| 200 |
$options = new Options();
|
| 201 |
$old_opt = $options->get_all();
|
| 202 |
|
| 203 |
+
// When checkbox is unchecked - it's not submitted at all, so we need to define its default false value.
|
| 204 |
+
if ( ! isset( $data['mail']['return_path'] ) ) {
|
| 205 |
+
$data['mail']['return_path'] = false;
|
| 206 |
+
}
|
| 207 |
+
if ( ! isset( $data['smtp']['autotls'] ) ) {
|
| 208 |
+
$data['smtp']['autotls'] = false;
|
| 209 |
+
}
|
| 210 |
+
if ( ! isset( $data['smtp']['auth'] ) ) {
|
| 211 |
+
$data['smtp']['auth'] = false;
|
| 212 |
+
}
|
| 213 |
+
|
| 214 |
// Remove all debug messages when switching mailers.
|
| 215 |
if ( $old_opt['mail']['mailer'] !== $data['mail']['mailer'] ) {
|
| 216 |
Debug::clear();
|
src/Admin/Pages/Test.php
CHANGED
|
@@ -170,7 +170,7 @@ class Test extends PageAbstract {
|
|
| 170 |
|
| 171 |
$mailer_text = '<strong>Params:</strong><br>';
|
| 172 |
|
| 173 |
-
$mailer_text .= '<strong>Mailer:</strong> ' . $
|
| 174 |
$mailer_text .= '<strong>Constants:</strong> ' . ( $options->is_const_enabled() ? 'Yes' : 'No' ) . '<br>';
|
| 175 |
|
| 176 |
// Display different debug info based on the mailer.
|
|
@@ -198,7 +198,7 @@ class Test extends PageAbstract {
|
|
| 198 |
if ( $options->is_mailer_smtp() ) {
|
| 199 |
$smtp_text = '<strong>SMTP Debug:</strong><br>';
|
| 200 |
if ( ! empty( $smtp_debug ) ) {
|
| 201 |
-
$smtp_text .= $smtp_debug;
|
| 202 |
} else {
|
| 203 |
$smtp_text .= '[empty]';
|
| 204 |
}
|
| 170 |
|
| 171 |
$mailer_text = '<strong>Params:</strong><br>';
|
| 172 |
|
| 173 |
+
$mailer_text .= '<strong>Mailer:</strong> ' . $options->get( 'mail', 'mailer' ) . '<br>';
|
| 174 |
$mailer_text .= '<strong>Constants:</strong> ' . ( $options->is_const_enabled() ? 'Yes' : 'No' ) . '<br>';
|
| 175 |
|
| 176 |
// Display different debug info based on the mailer.
|
| 198 |
if ( $options->is_mailer_smtp() ) {
|
| 199 |
$smtp_text = '<strong>SMTP Debug:</strong><br>';
|
| 200 |
if ( ! empty( $smtp_debug ) ) {
|
| 201 |
+
$smtp_text .= esc_textarea( $smtp_debug );
|
| 202 |
} else {
|
| 203 |
$smtp_text .= '[empty]';
|
| 204 |
}
|
src/Core.php
CHANGED
|
@@ -62,7 +62,7 @@ class Core {
|
|
| 62 |
public function init() {
|
| 63 |
|
| 64 |
// Load translations just in case.
|
| 65 |
-
load_plugin_textdomain( 'wp-mail-smtp', false, wp_mail_smtp()->plugin_path . '/languages' );
|
| 66 |
|
| 67 |
/*
|
| 68 |
* Constantly check in admin area, that we don't need to upgrade DB.
|
|
@@ -224,16 +224,18 @@ class Core {
|
|
| 224 |
update_option( 'wp_mail_smtp_version', WPMS_PLUGIN_VER );
|
| 225 |
|
| 226 |
// Create and store initial plugin settings.
|
| 227 |
-
$options
|
| 228 |
-
'
|
| 229 |
-
|
| 230 |
-
|
| 231 |
-
|
| 232 |
-
|
|
|
|
|
|
|
| 233 |
'autotls' => true,
|
| 234 |
),
|
| 235 |
);
|
| 236 |
|
| 237 |
-
Options::init()->set( $options );
|
| 238 |
}
|
| 239 |
}
|
| 62 |
public function init() {
|
| 63 |
|
| 64 |
// Load translations just in case.
|
| 65 |
+
load_plugin_textdomain( 'wp-mail-smtp', false, plugin_basename( wp_mail_smtp()->plugin_path ) . '/languages' );
|
| 66 |
|
| 67 |
/*
|
| 68 |
* Constantly check in admin area, that we don't need to upgrade DB.
|
| 224 |
update_option( 'wp_mail_smtp_version', WPMS_PLUGIN_VER );
|
| 225 |
|
| 226 |
// Create and store initial plugin settings.
|
| 227 |
+
$options = array(
|
| 228 |
+
'mail' => array(
|
| 229 |
+
'from_email' => get_option( 'admin_email' ),
|
| 230 |
+
'from_name' => get_bloginfo( 'name' ),
|
| 231 |
+
'mailer' => 'mail',
|
| 232 |
+
'return_path' => false,
|
| 233 |
+
),
|
| 234 |
+
'smtp' => array(
|
| 235 |
'autotls' => true,
|
| 236 |
),
|
| 237 |
);
|
| 238 |
|
| 239 |
+
Options::init()->set( $options, true );
|
| 240 |
}
|
| 241 |
}
|
src/MailCatcher.php
CHANGED
|
@@ -43,6 +43,9 @@ class MailCatcher extends \PHPMailer {
|
|
| 43 |
return parent::send();
|
| 44 |
}
|
| 45 |
|
|
|
|
|
|
|
|
|
|
| 46 |
// Prepare everything (including the message) for sending.
|
| 47 |
if ( ! $this->preSend() ) {
|
| 48 |
return false;
|
| 43 |
return parent::send();
|
| 44 |
}
|
| 45 |
|
| 46 |
+
// We need this so that the \PHPMailer class will correctly prepare all the headers.
|
| 47 |
+
$this->Mailer = 'mail';
|
| 48 |
+
|
| 49 |
// Prepare everything (including the message) for sending.
|
| 50 |
if ( ! $this->preSend() ) {
|
| 51 |
return false;
|
src/Options.php
CHANGED
|
@@ -191,6 +191,10 @@ class Options {
|
|
| 191 |
$value = $this->postprocess_key_defaults( $group, $key );
|
| 192 |
}
|
| 193 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 194 |
return apply_filters( 'wp_mail_smtp_options_get', $value, $group, $key );
|
| 195 |
}
|
| 196 |
|
|
@@ -440,10 +444,12 @@ class Options {
|
|
| 440 |
* Set plugin options, all at once.
|
| 441 |
*
|
| 442 |
* @since 1.0.0
|
|
|
|
| 443 |
*
|
| 444 |
-
* @param array $options
|
|
|
|
| 445 |
*/
|
| 446 |
-
public function set( $options ) {
|
| 447 |
|
| 448 |
foreach ( (array) $options as $group => $keys ) {
|
| 449 |
foreach ( $keys as $key_name => $key_value ) {
|
|
@@ -452,7 +458,7 @@ class Options {
|
|
| 452 |
switch ( $key_name ) {
|
| 453 |
case 'from_name':
|
| 454 |
case 'mailer':
|
| 455 |
-
$options[ $group ][ $key_name ] = $this->get_const_value( $group, $key_name,
|
| 456 |
break;
|
| 457 |
case 'from_email':
|
| 458 |
if ( filter_var( $options[ $group ][ $key_name ], FILTER_VALIDATE_EMAIL ) ) {
|
|
@@ -486,13 +492,13 @@ class Options {
|
|
| 486 |
switch ( $key_name ) {
|
| 487 |
case 'host':
|
| 488 |
case 'user':
|
| 489 |
-
$options[ $mailer ][ $key_name ] = $this->get_const_value( $mailer, $key_name,
|
| 490 |
break;
|
| 491 |
case 'port':
|
| 492 |
$options[ $mailer ][ $key_name ] = $this->get_const_value( $mailer, $key_name, intval( $options[ $mailer ][ $key_name ] ) );
|
| 493 |
break;
|
| 494 |
case 'encryption':
|
| 495 |
-
$options[ $mailer ][ $key_name ] = $this->get_const_value( $mailer, $key_name,
|
| 496 |
break;
|
| 497 |
case 'auth':
|
| 498 |
case 'autotls':
|
|
@@ -517,7 +523,12 @@ class Options {
|
|
| 517 |
|
| 518 |
$options = apply_filters( 'wp_mail_smtp_options_set', $options );
|
| 519 |
|
| 520 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 521 |
|
| 522 |
// Now we need to re-cache values.
|
| 523 |
$this->populate_options();
|
| 191 |
$value = $this->postprocess_key_defaults( $group, $key );
|
| 192 |
}
|
| 193 |
|
| 194 |
+
if ( is_string( $value ) ) {
|
| 195 |
+
$value = stripslashes( $value );
|
| 196 |
+
}
|
| 197 |
+
|
| 198 |
return apply_filters( 'wp_mail_smtp_options_get', $value, $group, $key );
|
| 199 |
}
|
| 200 |
|
| 444 |
* Set plugin options, all at once.
|
| 445 |
*
|
| 446 |
* @since 1.0.0
|
| 447 |
+
* @since 1.3.0 Added $once argument to save option only if they don't exist already.
|
| 448 |
*
|
| 449 |
+
* @param array $options Plugin options to save.
|
| 450 |
+
* @param bool $once Whether to update existing options or to add these options only once.
|
| 451 |
*/
|
| 452 |
+
public function set( $options, $once = false ) {
|
| 453 |
|
| 454 |
foreach ( (array) $options as $group => $keys ) {
|
| 455 |
foreach ( $keys as $key_name => $key_value ) {
|
| 458 |
switch ( $key_name ) {
|
| 459 |
case 'from_name':
|
| 460 |
case 'mailer':
|
| 461 |
+
$options[ $group ][ $key_name ] = $this->get_const_value( $group, $key_name, wp_strip_all_tags( $options[ $group ][ $key_name ], true ) );
|
| 462 |
break;
|
| 463 |
case 'from_email':
|
| 464 |
if ( filter_var( $options[ $group ][ $key_name ], FILTER_VALIDATE_EMAIL ) ) {
|
| 492 |
switch ( $key_name ) {
|
| 493 |
case 'host':
|
| 494 |
case 'user':
|
| 495 |
+
$options[ $mailer ][ $key_name ] = $this->get_const_value( $mailer, $key_name, wp_strip_all_tags( $options[ $mailer ][ $key_name ], true ) );
|
| 496 |
break;
|
| 497 |
case 'port':
|
| 498 |
$options[ $mailer ][ $key_name ] = $this->get_const_value( $mailer, $key_name, intval( $options[ $mailer ][ $key_name ] ) );
|
| 499 |
break;
|
| 500 |
case 'encryption':
|
| 501 |
+
$options[ $mailer ][ $key_name ] = $this->get_const_value( $mailer, $key_name, wp_strip_all_tags( $options[ $mailer ][ $key_name ], true ) );
|
| 502 |
break;
|
| 503 |
case 'auth':
|
| 504 |
case 'autotls':
|
| 523 |
|
| 524 |
$options = apply_filters( 'wp_mail_smtp_options_set', $options );
|
| 525 |
|
| 526 |
+
// Whether to update existing options or to add these options only once if they don't exist yet.
|
| 527 |
+
if ( $once ) {
|
| 528 |
+
add_option( self::META_KEY, $options, '', 'no' ); // Do not autoload these options.
|
| 529 |
+
} else {
|
| 530 |
+
update_option( self::META_KEY, $options, 'no' );
|
| 531 |
+
}
|
| 532 |
|
| 533 |
// Now we need to re-cache values.
|
| 534 |
$this->populate_options();
|
src/Providers/Gmail/Mailer.php
CHANGED
|
@@ -156,6 +156,12 @@ class Mailer extends MailerAbstract {
|
|
| 156 |
$modules = apache_get_modules();
|
| 157 |
$gmail_text[] = '<strong>Apache.mod_security:</strong> ' . ( in_array( 'mod_security', $modules, true ) || in_array( 'mod_security2', $modules, true ) ? 'Yes' : 'No' );
|
| 158 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 159 |
|
| 160 |
return implode( '<br>', $gmail_text );
|
| 161 |
}
|
| 156 |
$modules = apache_get_modules();
|
| 157 |
$gmail_text[] = '<strong>Apache.mod_security:</strong> ' . ( in_array( 'mod_security', $modules, true ) || in_array( 'mod_security2', $modules, true ) ? 'Yes' : 'No' );
|
| 158 |
}
|
| 159 |
+
if ( function_exists( 'selinux_is_enabled' ) ) {
|
| 160 |
+
$gmail_text[] = '<strong>OS.SELinux:</strong> ' . ( selinux_is_enabled() ? 'Yes' : 'No' );
|
| 161 |
+
}
|
| 162 |
+
if ( function_exists( 'grsecurity_is_enabled' ) ) {
|
| 163 |
+
$gmail_text[] = '<strong>OS.grsecurity:</strong> ' . ( grsecurity_is_enabled() ? 'Yes' : 'No' );
|
| 164 |
+
}
|
| 165 |
|
| 166 |
return implode( '<br>', $gmail_text );
|
| 167 |
}
|
src/Providers/Loader.php
CHANGED
|
@@ -4,6 +4,7 @@ namespace WPMailSMTP\Providers;
|
|
| 4 |
|
| 5 |
use WPMailSMTP\Debug;
|
| 6 |
use WPMailSMTP\MailCatcher;
|
|
|
|
| 7 |
|
| 8 |
/**
|
| 9 |
* Class Loader.
|
|
@@ -18,12 +19,12 @@ class Loader {
|
|
| 18 |
* @var array
|
| 19 |
*/
|
| 20 |
protected $providers = array(
|
| 21 |
-
'mail' => '
|
| 22 |
-
'gmail' => '
|
| 23 |
-
'mailgun' => '
|
| 24 |
-
'sendgrid' => '
|
| 25 |
-
'pepipost' => '
|
| 26 |
-
'smtp' => '
|
| 27 |
);
|
| 28 |
|
| 29 |
/**
|
|
@@ -39,6 +40,11 @@ class Loader {
|
|
| 39 |
* @return array
|
| 40 |
*/
|
| 41 |
public function get_providers() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
return apply_filters( 'wp_mail_smtp_providers_loader_get_providers', $this->providers );
|
| 43 |
}
|
| 44 |
|
| 4 |
|
| 5 |
use WPMailSMTP\Debug;
|
| 6 |
use WPMailSMTP\MailCatcher;
|
| 7 |
+
use WPMailSMTP\Options;
|
| 8 |
|
| 9 |
/**
|
| 10 |
* Class Loader.
|
| 19 |
* @var array
|
| 20 |
*/
|
| 21 |
protected $providers = array(
|
| 22 |
+
'mail' => 'WPMailSMTP\Providers\Mail\\',
|
| 23 |
+
'gmail' => 'WPMailSMTP\Providers\Gmail\\',
|
| 24 |
+
'mailgun' => 'WPMailSMTP\Providers\Mailgun\\',
|
| 25 |
+
'sendgrid' => 'WPMailSMTP\Providers\Sendgrid\\',
|
| 26 |
+
'pepipost' => 'WPMailSMTP\Providers\Pepipost\\',
|
| 27 |
+
'smtp' => 'WPMailSMTP\Providers\SMTP\\',
|
| 28 |
);
|
| 29 |
|
| 30 |
/**
|
| 40 |
* @return array
|
| 41 |
*/
|
| 42 |
public function get_providers() {
|
| 43 |
+
|
| 44 |
+
if ( ! Options::init()->is_pepipost_active() ) {
|
| 45 |
+
unset( $this->providers['pepipost'] );
|
| 46 |
+
}
|
| 47 |
+
|
| 48 |
return apply_filters( 'wp_mail_smtp_providers_loader_get_providers', $this->providers );
|
| 49 |
}
|
| 50 |
|
src/Providers/Mail/Mailer.php
CHANGED
|
@@ -29,6 +29,12 @@ class Mailer extends MailerAbstract {
|
|
| 29 |
$modules = apache_get_modules();
|
| 30 |
$mail_text[] = '<strong>Apache.mod_security:</strong> ' . ( in_array( 'mod_security', $modules, true ) || in_array( 'mod_security2', $modules, true ) ? 'Yes' : 'No' );
|
| 31 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
|
| 33 |
return implode( '<br>', $mail_text );
|
| 34 |
}
|
| 29 |
$modules = apache_get_modules();
|
| 30 |
$mail_text[] = '<strong>Apache.mod_security:</strong> ' . ( in_array( 'mod_security', $modules, true ) || in_array( 'mod_security2', $modules, true ) ? 'Yes' : 'No' );
|
| 31 |
}
|
| 32 |
+
if ( function_exists( 'selinux_is_enabled' ) ) {
|
| 33 |
+
$mail_text[] = '<strong>OS.SELinux:</strong> ' . ( selinux_is_enabled() ? 'Yes' : 'No' );
|
| 34 |
+
}
|
| 35 |
+
if ( function_exists( 'grsecurity_is_enabled' ) ) {
|
| 36 |
+
$mail_text[] = '<strong>OS.grsecurity:</strong> ' . ( grsecurity_is_enabled() ? 'Yes' : 'No' );
|
| 37 |
+
}
|
| 38 |
|
| 39 |
return implode( '<br>', $mail_text );
|
| 40 |
}
|
src/Providers/MailerAbstract.php
CHANGED
|
@@ -329,7 +329,7 @@ abstract class MailerAbstract implements MailerInterface {
|
|
| 329 |
}
|
| 330 |
|
| 331 |
/**
|
| 332 |
-
* This method is relevant to SMTP
|
| 333 |
* All other custom mailers should override it with own information.
|
| 334 |
*
|
| 335 |
* @since 1.2.0
|
|
@@ -343,7 +343,7 @@ abstract class MailerAbstract implements MailerInterface {
|
|
| 343 |
|
| 344 |
// Mail mailer has nothing to return.
|
| 345 |
if ( $this->options->is_mailer_smtp() ) {
|
| 346 |
-
$smtp_text[] = '<strong>ErrorInfo:</strong> ' . make_clickable( $phpmailer->ErrorInfo );
|
| 347 |
$smtp_text[] = '<strong>Host:</strong> ' . $phpmailer->Host;
|
| 348 |
$smtp_text[] = '<strong>Port:</strong> ' . $phpmailer->Port;
|
| 349 |
$smtp_text[] = '<strong>SMTPSecure:</strong> ' . Debug::pvar( $phpmailer->SMTPSecure );
|
|
@@ -360,6 +360,12 @@ abstract class MailerAbstract implements MailerInterface {
|
|
| 360 |
$modules = apache_get_modules();
|
| 361 |
$smtp_text[] = '<strong>Apache.mod_security:</strong> ' . ( in_array( 'mod_security', $modules, true ) || in_array( 'mod_security2', $modules, true ) ? 'Yes' : 'No' );
|
| 362 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 363 |
|
| 364 |
return implode( '<br>', $smtp_text );
|
| 365 |
}
|
| 329 |
}
|
| 330 |
|
| 331 |
/**
|
| 332 |
+
* This method is relevant to SMTP and Pepipost.
|
| 333 |
* All other custom mailers should override it with own information.
|
| 334 |
*
|
| 335 |
* @since 1.2.0
|
| 343 |
|
| 344 |
// Mail mailer has nothing to return.
|
| 345 |
if ( $this->options->is_mailer_smtp() ) {
|
| 346 |
+
$smtp_text[] = '<strong>ErrorInfo:</strong> ' . make_clickable( wp_strip_all_tags( $phpmailer->ErrorInfo ) );
|
| 347 |
$smtp_text[] = '<strong>Host:</strong> ' . $phpmailer->Host;
|
| 348 |
$smtp_text[] = '<strong>Port:</strong> ' . $phpmailer->Port;
|
| 349 |
$smtp_text[] = '<strong>SMTPSecure:</strong> ' . Debug::pvar( $phpmailer->SMTPSecure );
|
| 360 |
$modules = apache_get_modules();
|
| 361 |
$smtp_text[] = '<strong>Apache.mod_security:</strong> ' . ( in_array( 'mod_security', $modules, true ) || in_array( 'mod_security2', $modules, true ) ? 'Yes' : 'No' );
|
| 362 |
}
|
| 363 |
+
if ( function_exists( 'selinux_is_enabled' ) ) {
|
| 364 |
+
$smtp_text[] = '<strong>OS.SELinux:</strong> ' . ( selinux_is_enabled() ? 'Yes' : 'No' );
|
| 365 |
+
}
|
| 366 |
+
if ( function_exists( 'grsecurity_is_enabled' ) ) {
|
| 367 |
+
$smtp_text[] = '<strong>OS.grsecurity:</strong> ' . ( grsecurity_is_enabled() ? 'Yes' : 'No' );
|
| 368 |
+
}
|
| 369 |
|
| 370 |
return implode( '<br>', $smtp_text );
|
| 371 |
}
|
src/Providers/Mailgun/Mailer.php
CHANGED
|
@@ -324,7 +324,7 @@ class Mailer extends MailerAbstract {
|
|
| 324 |
}
|
| 325 |
}
|
| 326 |
|
| 327 |
-
return implode( '<br>', $error_text );
|
| 328 |
}
|
| 329 |
|
| 330 |
/**
|
| 324 |
}
|
| 325 |
}
|
| 326 |
|
| 327 |
+
return implode( '<br>', array_map( 'esc_textarea', $error_text ) );
|
| 328 |
}
|
| 329 |
|
| 330 |
/**
|
src/Providers/OptionsAbstract.php
CHANGED
|
@@ -198,7 +198,7 @@ abstract class OptionsAbstract implements OptionsInterface {
|
|
| 198 |
<input type="checkbox" id="wp-mail-smtp-setting-<?php echo esc_attr( $this->get_slug() ); ?>-autotls"
|
| 199 |
name="wp-mail-smtp[<?php echo esc_attr( $this->get_slug() ); ?>][autotls]" value="yes"
|
| 200 |
<?php echo $this->options->is_const_defined( $this->get_slug(), 'autotls' ) ? 'disabled' : ''; ?>
|
| 201 |
-
<?php checked( true, $this->options->get( $this->get_slug(), 'autotls' ) ); ?>
|
| 202 |
/>
|
| 203 |
<span class="wp-mail-smtp-setting-toggle-switch"></span>
|
| 204 |
<span class="wp-mail-smtp-setting-toggle-checked-label"><?php esc_html_e( 'On', 'wp-mail-smtp' ); ?></span>
|
|
@@ -220,7 +220,7 @@ abstract class OptionsAbstract implements OptionsInterface {
|
|
| 220 |
<input type="checkbox" id="wp-mail-smtp-setting-<?php echo esc_attr( $this->get_slug() ); ?>-auth"
|
| 221 |
name="wp-mail-smtp[<?php echo esc_attr( $this->get_slug() ); ?>][auth]" value="yes"
|
| 222 |
<?php echo $this->options->is_const_defined( $this->get_slug(), 'auth' ) ? 'disabled' : ''; ?>
|
| 223 |
-
<?php checked( true, $this->options->get( $this->get_slug(), 'auth' ) ); ?>
|
| 224 |
/>
|
| 225 |
<span class="wp-mail-smtp-setting-toggle-switch"></span>
|
| 226 |
<span class="wp-mail-smtp-setting-toggle-checked-label"><?php esc_html_e( 'On', 'wp-mail-smtp' ); ?></span>
|
| 198 |
<input type="checkbox" id="wp-mail-smtp-setting-<?php echo esc_attr( $this->get_slug() ); ?>-autotls"
|
| 199 |
name="wp-mail-smtp[<?php echo esc_attr( $this->get_slug() ); ?>][autotls]" value="yes"
|
| 200 |
<?php echo $this->options->is_const_defined( $this->get_slug(), 'autotls' ) ? 'disabled' : ''; ?>
|
| 201 |
+
<?php checked( true, (bool) $this->options->get( $this->get_slug(), 'autotls' ) ); ?>
|
| 202 |
/>
|
| 203 |
<span class="wp-mail-smtp-setting-toggle-switch"></span>
|
| 204 |
<span class="wp-mail-smtp-setting-toggle-checked-label"><?php esc_html_e( 'On', 'wp-mail-smtp' ); ?></span>
|
| 220 |
<input type="checkbox" id="wp-mail-smtp-setting-<?php echo esc_attr( $this->get_slug() ); ?>-auth"
|
| 221 |
name="wp-mail-smtp[<?php echo esc_attr( $this->get_slug() ); ?>][auth]" value="yes"
|
| 222 |
<?php echo $this->options->is_const_defined( $this->get_slug(), 'auth' ) ? 'disabled' : ''; ?>
|
| 223 |
+
<?php checked( true, (bool) $this->options->get( $this->get_slug(), 'auth' ) ); ?>
|
| 224 |
/>
|
| 225 |
<span class="wp-mail-smtp-setting-toggle-switch"></span>
|
| 226 |
<span class="wp-mail-smtp-setting-toggle-checked-label"><?php esc_html_e( 'On', 'wp-mail-smtp' ); ?></span>
|
src/Providers/Sendgrid/Mailer.php
CHANGED
|
@@ -324,7 +324,7 @@ class Mailer extends MailerAbstract {
|
|
| 324 |
}
|
| 325 |
}
|
| 326 |
|
| 327 |
-
return implode( '<br>', $error_text );
|
| 328 |
}
|
| 329 |
|
| 330 |
/**
|
| 324 |
}
|
| 325 |
}
|
| 326 |
|
| 327 |
+
return implode( '<br>', array_map( 'esc_textarea', $error_text ) );
|
| 328 |
}
|
| 329 |
|
| 330 |
/**
|
wp_mail_smtp.php
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
<?php
|
| 2 |
/**
|
| 3 |
* Plugin Name: WP Mail SMTP
|
| 4 |
-
* Version: 1.2.
|
| 5 |
* Plugin URI: https://wpforms.com/
|
| 6 |
* Description: Reconfigures the wp_mail() function to use SMTP instead of mail() and creates an options page to manage the settings.
|
| 7 |
* Author: WPForms
|
|
@@ -17,7 +17,7 @@
|
|
| 17 |
* http://www.gnu.org/licenses/gpl.txt
|
| 18 |
*/
|
| 19 |
|
| 20 |
-
define( 'WPMS_PLUGIN_VER', '1.2.
|
| 21 |
define( 'WPMS_PHP_VER', '5.3' );
|
| 22 |
|
| 23 |
/**
|
| 1 |
<?php
|
| 2 |
/**
|
| 3 |
* Plugin Name: WP Mail SMTP
|
| 4 |
+
* Version: 1.2.5
|
| 5 |
* Plugin URI: https://wpforms.com/
|
| 6 |
* Description: Reconfigures the wp_mail() function to use SMTP instead of mail() and creates an options page to manage the settings.
|
| 7 |
* Author: WPForms
|
| 17 |
* http://www.gnu.org/licenses/gpl.txt
|
| 18 |
*/
|
| 19 |
|
| 20 |
+
define( 'WPMS_PLUGIN_VER', '1.2.5' );
|
| 21 |
define( 'WPMS_PHP_VER', '5.3' );
|
| 22 |
|
| 23 |
/**
|
