summaryrefslogtreecommitdiff
path: root/Postman
diff options
context:
space:
mode:
authoryehudah <yehudah@b8457f37-d9ea-0310-8a92-e5e31aec5664>2020-08-11 21:39:07 +0000
committeryehudah <yehudah@b8457f37-d9ea-0310-8a92-e5e31aec5664>2020-08-11 21:39:07 +0000
commit3a1c1adcc5aef8b0256960e6643f17f8a790ad77 (patch)
tree69c116b9ecfb27e7b2c2dbc42d35f7ce9d898710 /Postman
parenteaf171477da589dcc04e96a2cc105231328319e2 (diff)
downloadPost-SMTP-3a1c1adcc5aef8b0256960e6643f17f8a790ad77.zip
WordPress 5.5 compatibility
Diffstat (limited to 'Postman')
-rw-r--r--Postman/Phpmailer/PostsmtpMailer.php26
1 files changed, 23 insertions, 3 deletions
diff --git a/Postman/Phpmailer/PostsmtpMailer.php b/Postman/Phpmailer/PostsmtpMailer.php
index b8227d5..cbea5f8 100644
--- a/Postman/Phpmailer/PostsmtpMailer.php
+++ b/Postman/Phpmailer/PostsmtpMailer.php
@@ -3,10 +3,30 @@ if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
-if ( ! class_exists( 'PHPMailer', false ) ) {
- require_once ABSPATH . WPINC . '/class-phpmailer.php';
+if ( version_compare( get_bloginfo( 'version' ), '5.5-alpha', '<' ) ) {
+ if ( ! class_exists( '\PHPMailer', false ) ) {
+ require_once ABSPATH . WPINC . '/class-phpmailer.php';
+ }
+
+} else {
+ if ( ! class_exists( '\PHPMailer\PHPMailer\PHPMailer', false ) ) {
+ require_once ABSPATH . WPINC . '/PHPMailer/PHPMailer.php';
+ }
+
+ if ( ! class_exists( '\PHPMailer\PHPMailer\Exception', false ) ) {
+ require_once ABSPATH . WPINC . '/PHPMailer/Exception.php';
+ }
+
+ if ( ! class_exists( '\PHPMailer\PHPMailer\SMTP', false ) ) {
+ require_once ABSPATH . WPINC . '/PHPMailer/SMTP.php';
+ }
+
+ class_alias( PHPMailer\PHPMailer\PHPMailer::class, 'PHPMailer' );
+ class_alias( PHPMailer\PHPMailer\SMTP::class, 'SMTP' );
+ class_alias( PHPMailer\PHPMailer\Exception::class, 'phpmailerException' );
}
+
add_action('plugins_loaded', function() {
global $phpmailer;
@@ -120,7 +140,7 @@ class PostsmtpMailer extends PHPMailer {
return $result;
- } catch (phpmailerException $exc) {
+ } catch (Exception $exc) {
$this->error = $exc;