summaryrefslogtreecommitdiff
path: root/Postman/Phpmailer/PostsmtpMailer.php
diff options
context:
space:
mode:
Diffstat (limited to 'Postman/Phpmailer/PostsmtpMailer.php')
-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;