| @@ -111,12 +111,18 @@ | ||
| 111 | 111 | { |
| 112 | 112 | // hook to the PHPMailer init action |
| 113 | 113 | add_action('phpmailer_init', function(&$phpmailer) use ($name, $value) |
| 114 | 114 | { |
| 115 | - if (!$phpmailer instanceof PHPMailer) | |
| 115 | + /** | |
| 116 | + * Make sure the provided argument is actually an object. | |
| 117 | + * | |
| 118 | + * @since 10.1.61 Ignore the PHPMailer class check, since it might be prefixed by a namespace. | |
| 119 | + * Receiving an object is enough for us. | |
| 120 | + */ | |
| 121 | + if (!is_object($phpmailer)) | |
| 116 | 122 | { |
| 117 | 123 | // safety check |
| 118 | - return $phpmailer; | |
| 124 | + return; | |
| 119 | 125 | } |
| 120 | 126 | |
| 121 | 127 | /** |
| 122 | 128 | * Check whether the specified property is supported by PHPMailer. |
| @@ -411,18 +417,24 @@ | ||
| 411 | 417 | { |
| 412 | 418 | // hook to the PHPMailer init action |
| 413 | 419 | add_action('phpmailer_init', function(&$phpmailer) use ($auth, $host, $user, $pass, $secure, $port) |
| 414 | 420 | { |
| 415 | - if (!$phpmailer instanceof PHPMailer) | |
| 421 | + /** | |
| 422 | + * Make sure the provided argument is actually an object. | |
| 423 | + * | |
| 424 | + * @since 10.1.62 Ignore the PHPMailer class check, since it might be prefixed by a namespace. | |
| 425 | + * Receiving an object is enough for us. | |
| 426 | + */ | |
| 427 | + if (!is_object($phpmailer)) | |
| 416 | 428 | { |
| 417 | 429 | // safety check |
| 418 | - return $phpmailer; | |
| 430 | + return; | |
| 419 | 431 | } |
| 420 | 432 | |
| 421 | 433 | if ($auth === null || $host === null || $user === null || $pass === null) |
| 422 | 434 | { |
| 423 | 435 | // do not interfere if the plugin parameters are null |
| 424 | - return $phpmailer; | |
| 436 | + return; | |
| 425 | 437 | } |
| 426 | 438 | |
| 427 | 439 | // Tell PHPMailer to use SMTP |
| 428 | 440 | $phpmailer->isSMTP(); |
| @@ -444,13 +456,13 @@ | ||
| 444 | 456 | |
| 445 | 457 | if ($secure == 'ssl' || $secure == 'tls') |
| 446 | 458 | { |
| 447 | 459 | $phpmailer->SMTPSecure = $secure; |
| 448 | - } else { | |
| 460 | + } | |
| 461 | + else | |
| 462 | + { | |
| 449 | 463 | $phpmailer->SMTPAutoTLS = false; |
| 450 | 464 | } |
| 451 | - | |
| 452 | - return $phpmailer; | |
| 453 | 465 | }); |
| 454 | 466 | |
| 455 | 467 | return true; |
| 456 | 468 | } |