forked from XiaoLFeng/XF_Index
PHPMailer
This commit is contained in:
parent
7fec6f19a4
commit
e639b2d6ef
|
@ -1,11 +1,15 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* Copyright © 2016 - 2023 筱锋xiao_lfeng. All Rights Reserved.
|
||||
* 开发开源遵循 MIT 许可,若需商用请联系开发者
|
||||
* https://www.x-lf.com/
|
||||
*/
|
||||
|
||||
namespace Mailer\PHPMailer;
|
||||
namespace Mailer;
|
||||
|
||||
use function array_keys;
|
||||
use const PHP_VERSION_ID;
|
||||
|
||||
/**
|
||||
* Configure PHPMailer with DSN string.
|
||||
|
@ -170,7 +174,7 @@ private function configureOptions(PHPMailer $mailer, $options)
|
|||
unset($allowedOptions['Port']);
|
||||
unset($allowedOptions['ErrorInfo']);
|
||||
|
||||
$allowedOptions = \array_keys($allowedOptions);
|
||||
$allowedOptions = array_keys($allowedOptions);
|
||||
|
||||
foreach ($options as $key => $value) {
|
||||
if (!in_array($key, $allowedOptions)) {
|
||||
|
@ -215,7 +219,7 @@ private function configureOptions(PHPMailer $mailer, $options)
|
|||
*/
|
||||
protected function parseUrl($url)
|
||||
{
|
||||
if (\PHP_VERSION_ID >= 50600 || false === strpos($url, '?')) {
|
||||
if (PHP_VERSION_ID >= 50600 || false === strpos($url, '?')) {
|
||||
return parse_url($url);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* Copyright © 2016 - 2023 筱锋xiao_lfeng. All Rights Reserved.
|
||||
* 开发开源遵循 MIT 许可,若需商用请联系开发者
|
||||
* https://www.x-lf.com/
|
||||
*/
|
||||
|
||||
namespace Mailer\PHPMailer;
|
||||
namespace Mailer;
|
||||
|
||||
/**
|
||||
* PHPMailer exception handler.
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* Copyright © 2016 - 2023 筱锋xiao_lfeng. All Rights Reserved.
|
||||
* 开发开源遵循 MIT 许可,若需商用请联系开发者
|
||||
* https://www.x-lf.com/
|
||||
*/
|
||||
|
||||
namespace Mailer\PHPMailer;
|
||||
namespace Mailer;
|
||||
|
||||
use League\OAuth2\Client\Grant\RefreshToken;
|
||||
use League\OAuth2\Client\Provider\AbstractProvider;
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* Copyright © 2016 - 2023 筱锋xiao_lfeng. All Rights Reserved.
|
||||
* 开发开源遵循 MIT 许可,若需商用请联系开发者
|
||||
* https://www.x-lf.com/
|
||||
*/
|
||||
|
||||
namespace Mailer\PHPMailer;
|
||||
namespace Mailer;
|
||||
|
||||
/**
|
||||
* OAuthTokenProvider - OAuth2 token provider interface.
|
||||
|
|
|
@ -1,11 +1,24 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* Copyright © 2016 - 2023 筱锋xiao_lfeng. All Rights Reserved.
|
||||
* 开发开源遵循 MIT 许可,若需商用请联系开发者
|
||||
* https://www.x-lf.com/
|
||||
*/
|
||||
|
||||
namespace Mailer\PHPMailer;
|
||||
namespace Mailer;
|
||||
|
||||
use Exception;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use const IDNA_CHECK_BIDI;
|
||||
use const IDNA_CHECK_CONTEXTJ;
|
||||
use const IDNA_DEFAULT;
|
||||
use const IDNA_NONTRANSITIONAL_TO_ASCII;
|
||||
use const IDNA_USE_STD3_RULES;
|
||||
use const INTL_IDNA_VARIANT_2003;
|
||||
use const INTL_IDNA_VARIANT_UTS46;
|
||||
use const PHP_MAJOR_VERSION;
|
||||
use const PHP_VERSION_ID;
|
||||
|
||||
/**
|
||||
* PHPMailer - PHP email creation and transport class.
|
||||
|
@ -409,7 +422,7 @@ class PHPMailer
|
|||
*
|
||||
* @see SMTP::$Debugoutput
|
||||
*
|
||||
* @var string|callable|\Psr\Log\LoggerInterface
|
||||
* @var string|callable|LoggerInterface
|
||||
*/
|
||||
public $Debugoutput = 'echo';
|
||||
|
||||
|
@ -881,7 +894,7 @@ protected function edebug($str)
|
|||
return;
|
||||
}
|
||||
//Is this a PSR-3 logger?
|
||||
if ($this->Debugoutput instanceof \Psr\Log\LoggerInterface) {
|
||||
if ($this->Debugoutput instanceof LoggerInterface) {
|
||||
$this->Debugoutput->debug($str);
|
||||
|
||||
return;
|
||||
|
@ -930,7 +943,7 @@ protected function edebug($str)
|
|||
*
|
||||
* @param bool $isHtml True for HTML mode
|
||||
*/
|
||||
public function isHTML(bool $isHtml = true)
|
||||
public function isHTML($isHtml = true)
|
||||
{
|
||||
if ($isHtml) {
|
||||
$this->ContentType = static::CONTENT_TYPE_TEXT_HTML;
|
||||
|
@ -1464,13 +1477,13 @@ public function punyencodeAddress($address)
|
|||
//Use the current punycode standard (appeared in PHP 7.2)
|
||||
$punycode = idn_to_ascii(
|
||||
$domain,
|
||||
\IDNA_DEFAULT | \IDNA_USE_STD3_RULES | \IDNA_CHECK_BIDI |
|
||||
\IDNA_CHECK_CONTEXTJ | \IDNA_NONTRANSITIONAL_TO_ASCII,
|
||||
\INTL_IDNA_VARIANT_UTS46
|
||||
IDNA_DEFAULT | IDNA_USE_STD3_RULES | IDNA_CHECK_BIDI |
|
||||
IDNA_CHECK_CONTEXTJ | IDNA_NONTRANSITIONAL_TO_ASCII,
|
||||
INTL_IDNA_VARIANT_UTS46
|
||||
);
|
||||
} elseif (defined('INTL_IDNA_VARIANT_2003')) {
|
||||
//Fall back to this old, deprecated/removed encoding
|
||||
$punycode = idn_to_ascii($domain, $errorcode, \INTL_IDNA_VARIANT_2003);
|
||||
$punycode = idn_to_ascii($domain, $errorcode, INTL_IDNA_VARIANT_2003);
|
||||
} else {
|
||||
//Fall back to a default we don't know about
|
||||
$punycode = idn_to_ascii($domain, $errorcode);
|
||||
|
@ -1522,7 +1535,7 @@ public function preSend()
|
|||
{
|
||||
if (
|
||||
'smtp' === $this->Mailer
|
||||
|| ('mail' === $this->Mailer && (\PHP_VERSION_ID >= 80000 || stripos(PHP_OS, 'WIN') === 0))
|
||||
|| ('mail' === $this->Mailer && (PHP_VERSION_ID >= 80000 || stripos(PHP_OS, 'WIN') === 0))
|
||||
) {
|
||||
//SMTP mandates RFC-compliant line endings
|
||||
//and it's also used with mail() on Windows
|
||||
|
@ -1534,8 +1547,8 @@ public function preSend()
|
|||
//Check for buggy PHP versions that add a header with an incorrect line break
|
||||
if (
|
||||
'mail' === $this->Mailer
|
||||
&& ((\PHP_VERSION_ID >= 70000 && \PHP_VERSION_ID < 70017)
|
||||
|| (\PHP_VERSION_ID >= 70100 && \PHP_VERSION_ID < 70103))
|
||||
&& ((PHP_VERSION_ID >= 70000 && PHP_VERSION_ID < 70017)
|
||||
|| (PHP_VERSION_ID >= 70100 && PHP_VERSION_ID < 70103))
|
||||
&& ini_get('mail.add_x_header') === '1'
|
||||
&& stripos(PHP_OS, 'WIN') === 0
|
||||
) {
|
||||
|
@ -1995,7 +2008,7 @@ public function setSMTPInstance(SMTP $smtp)
|
|||
*
|
||||
* @see PHPMailer::setSMTPInstance() to use a different class.
|
||||
*
|
||||
* @uses \Mailer\PHPMailer\SMTP
|
||||
* @uses SMTP
|
||||
*
|
||||
*/
|
||||
protected function smtpSend($header, $body)
|
||||
|
@ -2080,7 +2093,7 @@ protected function smtpSend($header, $body)
|
|||
* @return bool
|
||||
* @throws Exception
|
||||
*
|
||||
* @uses \Mailer\PHPMailer\SMTP
|
||||
* @uses SMTP
|
||||
*
|
||||
*/
|
||||
public function smtpConnect($options = null)
|
||||
|
@ -2767,7 +2780,7 @@ protected function generateId()
|
|||
if (function_exists('random_bytes')) {
|
||||
try {
|
||||
$bytes = random_bytes($len);
|
||||
} catch (\Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
//Do nothing
|
||||
}
|
||||
} elseif (function_exists('openssl_random_pseudo_bytes')) {
|
||||
|
@ -4760,13 +4773,13 @@ public function DKIM_Sign($signHeader)
|
|||
$privKey = openssl_pkey_get_private($privKeyStr);
|
||||
}
|
||||
if (openssl_sign($signHeader, $signature, $privKey, 'sha256WithRSAEncryption')) {
|
||||
if (\PHP_MAJOR_VERSION < 8) {
|
||||
if (PHP_MAJOR_VERSION < 8) {
|
||||
openssl_pkey_free($privKey);
|
||||
}
|
||||
|
||||
return base64_encode($signature);
|
||||
}
|
||||
if (\PHP_MAJOR_VERSION < 8) {
|
||||
if (PHP_MAJOR_VERSION < 8) {
|
||||
openssl_pkey_free($privKey);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,14 +1,15 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* Copyright © 2016 - 2023 筱锋xiao_lfeng. All Rights Reserved.
|
||||
* 开发开源遵循 MIT 许可,若需商用请联系开发者
|
||||
* https://www.x-lf.com/
|
||||
*/
|
||||
|
||||
namespace Mailer\PHPMailer;
|
||||
namespace Mailer;
|
||||
|
||||
/**
|
||||
* PHPMailer POP-Before-SMTP Authentication class.
|
||||
* PHPMailer POP-Before-SMTP Authentication Class.
|
||||
* Specifically for PHPMailer to use for RFC1939 POP-before-SMTP authentication.
|
||||
* 1) This class does not support APOP authentication.
|
||||
* 2) Opening and closing lots of POP3 connections can be quite slow. If you need
|
||||
|
|
|
@ -1,11 +1,14 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* Copyright © 2016 - 2023 筱锋xiao_lfeng. All Rights Reserved.
|
||||
* 开发开源遵循 MIT 许可,若需商用请联系开发者
|
||||
* https://www.x-lf.com/
|
||||
*/
|
||||
|
||||
namespace Mailer\PHPMailer;
|
||||
namespace Mailer;
|
||||
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
/**
|
||||
* PHPMailer RFC821 SMTP email transport class.
|
||||
|
@ -131,7 +134,7 @@ class SMTP
|
|||
* $mail->Debugoutput = new myPsr3Logger;
|
||||
* ```
|
||||
*
|
||||
* @var string|callable|\Psr\Log\LoggerInterface
|
||||
* @var string|callable|LoggerInterface
|
||||
*/
|
||||
public $Debugoutput = 'echo';
|
||||
|
||||
|
@ -253,7 +256,7 @@ protected function edebug($str, $level = 0)
|
|||
return;
|
||||
}
|
||||
//Is this a PSR-3 logger?
|
||||
if ($this->Debugoutput instanceof \Psr\Log\LoggerInterface) {
|
||||
if ($this->Debugoutput instanceof LoggerInterface) {
|
||||
$this->Debugoutput->debug($str);
|
||||
|
||||
return;
|
||||
|
|
Loading…
Reference in New Issue
Block a user