[Web] Minor fixes
parent
64264767d7
commit
6b3ea28501
|
@ -356,7 +356,7 @@ if (isset($_SESSION['mailcow_cc_role'])) {
|
||||||
<label class="control-label col-sm-2" for="xmpp_prefix"><?=$lang['edit']['xmpp_prefix'];?></label>
|
<label class="control-label col-sm-2" for="xmpp_prefix"><?=$lang['edit']['xmpp_prefix'];?></label>
|
||||||
<div class="col-md-10">
|
<div class="col-md-10">
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<input type="text" class="form-control" id="xmpp-prefix" name="xmpp_prefix" value="<?=htmlspecialchars($result['xmpp_prefix'], ENT_QUOTES, 'UTF-8');?>" required>
|
<input type="text" class="form-control" id="xmpp-prefix" name="xmpp_prefix" value="<?=(!empty($result['xmpp_prefix'])) ? htmlspecialchars($result['xmpp_prefix'], ENT_QUOTES, 'UTF-8') : 'im';?>" required>
|
||||||
<span class="input-group-addon">.<?=htmlspecialchars($domain, ENT_QUOTES, 'UTF-8');?></span>
|
<span class="input-group-addon">.<?=htmlspecialchars($domain, ENT_QUOTES, 'UTF-8');?></span>
|
||||||
</div>
|
</div>
|
||||||
<small class="help-block"><?=sprintf($lang['edit']['xmpp_prefix_info'], getenv('MAILCOW_HOSTNAME'));?></small>
|
<small class="help-block"><?=sprintf($lang['edit']['xmpp_prefix_info'], getenv('MAILCOW_HOSTNAME'));?></small>
|
||||||
|
|
|
@ -447,12 +447,12 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) {
|
||||||
if (empty($description)) {
|
if (empty($description)) {
|
||||||
$description = $domain;
|
$description = $domain;
|
||||||
}
|
}
|
||||||
$aliases = $_data['aliases'];
|
$aliases = (int)$_data['aliases'];
|
||||||
$mailboxes = $_data['mailboxes'];
|
$mailboxes = (int)$_data['mailboxes'];
|
||||||
$defquota = $_data['defquota'];
|
$defquota = (int)$_data['defquota'];
|
||||||
$maxquota = $_data['maxquota'];
|
$maxquota = (int)$_data['maxquota'];
|
||||||
$restart_sogo = $_data['restart_sogo'];
|
$restart_sogo = (int)$_data['restart_sogo'];
|
||||||
$quota = $_data['quota'];
|
$quota = (int)$_data['quota'];
|
||||||
if ($defquota > $maxquota) {
|
if ($defquota > $maxquota) {
|
||||||
$_SESSION['return'][] = array(
|
$_SESSION['return'][] = array(
|
||||||
'type' => 'danger',
|
'type' => 'danger',
|
||||||
|
|
|
@ -144,16 +144,16 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "matthiasmullie/minify",
|
"name": "matthiasmullie/minify",
|
||||||
"version": "1.3.65",
|
"version": "1.3.66",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/matthiasmullie/minify.git",
|
"url": "https://github.com/matthiasmullie/minify.git",
|
||||||
"reference": "227f19062451c55a797e0cc667ef983834e6580c"
|
"reference": "45fd3b0f1dfa2c965857c6d4a470bea52adc31a6"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/matthiasmullie/minify/zipball/227f19062451c55a797e0cc667ef983834e6580c",
|
"url": "https://api.github.com/repos/matthiasmullie/minify/zipball/45fd3b0f1dfa2c965857c6d4a470bea52adc31a6",
|
||||||
"reference": "227f19062451c55a797e0cc667ef983834e6580c",
|
"reference": "45fd3b0f1dfa2c965857c6d4a470bea52adc31a6",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
|
@ -163,8 +163,8 @@
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"friendsofphp/php-cs-fixer": "~2.0",
|
"friendsofphp/php-cs-fixer": "~2.0",
|
||||||
"matthiasmullie/scrapbook": "~1.0",
|
"matthiasmullie/scrapbook": "dev-master",
|
||||||
"phpunit/phpunit": "~4.8"
|
"phpunit/phpunit": ">=4.8"
|
||||||
},
|
},
|
||||||
"suggest": {
|
"suggest": {
|
||||||
"psr/cache-implementation": "Cache implementation to use with Minify::cache"
|
"psr/cache-implementation": "Cache implementation to use with Minify::cache"
|
||||||
|
@ -202,7 +202,7 @@
|
||||||
],
|
],
|
||||||
"support": {
|
"support": {
|
||||||
"issues": "https://github.com/matthiasmullie/minify/issues",
|
"issues": "https://github.com/matthiasmullie/minify/issues",
|
||||||
"source": "https://github.com/matthiasmullie/minify/tree/1.3.65"
|
"source": "https://github.com/matthiasmullie/minify/tree/1.3.66"
|
||||||
},
|
},
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
|
@ -218,7 +218,7 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"time": "2020-12-27T21:43:29+00:00"
|
"time": "2021-01-06T15:18:10+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "matthiasmullie/path-converter",
|
"name": "matthiasmullie/path-converter",
|
||||||
|
@ -461,16 +461,16 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "phpmailer/phpmailer",
|
"name": "phpmailer/phpmailer",
|
||||||
"version": "v6.2.0",
|
"version": "v6.3.0",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/PHPMailer/PHPMailer.git",
|
"url": "https://github.com/PHPMailer/PHPMailer.git",
|
||||||
"reference": "e38888a75c070304ca5514197d4847a59a5c853f"
|
"reference": "4a08cf4cdd2c38d12ee2b9fa69e5d235f37a6dcb"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/e38888a75c070304ca5514197d4847a59a5c853f",
|
"url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/4a08cf4cdd2c38d12ee2b9fa69e5d235f37a6dcb",
|
||||||
"reference": "e38888a75c070304ca5514197d4847a59a5c853f",
|
"reference": "4a08cf4cdd2c38d12ee2b9fa69e5d235f37a6dcb",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
|
@ -525,7 +525,7 @@
|
||||||
"description": "PHPMailer is a full-featured email creation and transfer class for PHP",
|
"description": "PHPMailer is a full-featured email creation and transfer class for PHP",
|
||||||
"support": {
|
"support": {
|
||||||
"issues": "https://github.com/PHPMailer/PHPMailer/issues",
|
"issues": "https://github.com/PHPMailer/PHPMailer/issues",
|
||||||
"source": "https://github.com/PHPMailer/PHPMailer/tree/v6.2.0"
|
"source": "https://github.com/PHPMailer/PHPMailer/tree/v6.3.0"
|
||||||
},
|
},
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
|
@ -533,7 +533,7 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"time": "2020-11-25T15:24:57+00:00"
|
"time": "2021-02-19T15:28:08+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "robthree/twofactorauth",
|
"name": "robthree/twofactorauth",
|
||||||
|
|
|
@ -42,6 +42,8 @@ namespace Composer\Autoload;
|
||||||
*/
|
*/
|
||||||
class ClassLoader
|
class ClassLoader
|
||||||
{
|
{
|
||||||
|
private $vendorDir;
|
||||||
|
|
||||||
// PSR-4
|
// PSR-4
|
||||||
private $prefixLengthsPsr4 = array();
|
private $prefixLengthsPsr4 = array();
|
||||||
private $prefixDirsPsr4 = array();
|
private $prefixDirsPsr4 = array();
|
||||||
|
@ -57,6 +59,13 @@ class ClassLoader
|
||||||
private $missingClasses = array();
|
private $missingClasses = array();
|
||||||
private $apcuPrefix;
|
private $apcuPrefix;
|
||||||
|
|
||||||
|
private static $registeredLoaders = array();
|
||||||
|
|
||||||
|
public function __construct($vendorDir = null)
|
||||||
|
{
|
||||||
|
$this->vendorDir = $vendorDir;
|
||||||
|
}
|
||||||
|
|
||||||
public function getPrefixes()
|
public function getPrefixes()
|
||||||
{
|
{
|
||||||
if (!empty($this->prefixesPsr0)) {
|
if (!empty($this->prefixesPsr0)) {
|
||||||
|
@ -300,6 +309,15 @@ class ClassLoader
|
||||||
public function register($prepend = false)
|
public function register($prepend = false)
|
||||||
{
|
{
|
||||||
spl_autoload_register(array($this, 'loadClass'), true, $prepend);
|
spl_autoload_register(array($this, 'loadClass'), true, $prepend);
|
||||||
|
|
||||||
|
if (null === $this->vendorDir) {
|
||||||
|
//no-op
|
||||||
|
} elseif ($prepend) {
|
||||||
|
self::$registeredLoaders = array($this->vendorDir => $this) + self::$registeredLoaders;
|
||||||
|
} else {
|
||||||
|
unset(self::$registeredLoaders[$this->vendorDir]);
|
||||||
|
self::$registeredLoaders[$this->vendorDir] = $this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -308,6 +326,10 @@ class ClassLoader
|
||||||
public function unregister()
|
public function unregister()
|
||||||
{
|
{
|
||||||
spl_autoload_unregister(array($this, 'loadClass'));
|
spl_autoload_unregister(array($this, 'loadClass'));
|
||||||
|
|
||||||
|
if (null !== $this->vendorDir) {
|
||||||
|
unset(self::$registeredLoaders[$this->vendorDir]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -367,6 +389,16 @@ class ClassLoader
|
||||||
return $file;
|
return $file;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the currently registered loaders indexed by their corresponding vendor directories.
|
||||||
|
*
|
||||||
|
* @return self[]
|
||||||
|
*/
|
||||||
|
public static function getRegisteredLoaders()
|
||||||
|
{
|
||||||
|
return self::$registeredLoaders;
|
||||||
|
}
|
||||||
|
|
||||||
private function findFileWithExtension($class, $ext)
|
private function findFileWithExtension($class, $ext)
|
||||||
{
|
{
|
||||||
// PSR-4 lookup
|
// PSR-4 lookup
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
|
|
||||||
namespace Composer;
|
namespace Composer;
|
||||||
|
|
||||||
|
use Composer\Autoload\ClassLoader;
|
||||||
use Composer\Semver\VersionParser;
|
use Composer\Semver\VersionParser;
|
||||||
|
|
||||||
|
|
||||||
|
@ -70,12 +71,12 @@ private static $installed = array (
|
||||||
),
|
),
|
||||||
'matthiasmullie/minify' =>
|
'matthiasmullie/minify' =>
|
||||||
array (
|
array (
|
||||||
'pretty_version' => '1.3.65',
|
'pretty_version' => '1.3.66',
|
||||||
'version' => '1.3.65.0',
|
'version' => '1.3.66.0',
|
||||||
'aliases' =>
|
'aliases' =>
|
||||||
array (
|
array (
|
||||||
),
|
),
|
||||||
'reference' => '227f19062451c55a797e0cc667ef983834e6580c',
|
'reference' => '45fd3b0f1dfa2c965857c6d4a470bea52adc31a6',
|
||||||
),
|
),
|
||||||
'matthiasmullie/path-converter' =>
|
'matthiasmullie/path-converter' =>
|
||||||
array (
|
array (
|
||||||
|
@ -122,12 +123,12 @@ private static $installed = array (
|
||||||
),
|
),
|
||||||
'phpmailer/phpmailer' =>
|
'phpmailer/phpmailer' =>
|
||||||
array (
|
array (
|
||||||
'pretty_version' => 'v6.2.0',
|
'pretty_version' => 'v6.3.0',
|
||||||
'version' => '6.2.0.0',
|
'version' => '6.3.0.0',
|
||||||
'aliases' =>
|
'aliases' =>
|
||||||
array (
|
array (
|
||||||
),
|
),
|
||||||
'reference' => 'e38888a75c070304ca5514197d4847a59a5c853f',
|
'reference' => '4a08cf4cdd2c38d12ee2b9fa69e5d235f37a6dcb',
|
||||||
),
|
),
|
||||||
'robthree/twofactorauth' =>
|
'robthree/twofactorauth' =>
|
||||||
array (
|
array (
|
||||||
|
@ -158,6 +159,8 @@ private static $installed = array (
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
private static $canGetVendors;
|
||||||
|
private static $installedByVendor = array();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -167,7 +170,17 @@ private static $installed = array (
|
||||||
|
|
||||||
public static function getInstalledPackages()
|
public static function getInstalledPackages()
|
||||||
{
|
{
|
||||||
return array_keys(self::$installed['versions']);
|
$packages = array();
|
||||||
|
foreach (self::getInstalled() as $installed) {
|
||||||
|
$packages[] = array_keys($installed['versions']);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (1 === \count($packages)) {
|
||||||
|
return $packages[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
return array_keys(array_flip(\call_user_func_array('array_merge', $packages)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -180,7 +193,13 @@ return array_keys(self::$installed['versions']);
|
||||||
|
|
||||||
public static function isInstalled($packageName)
|
public static function isInstalled($packageName)
|
||||||
{
|
{
|
||||||
return isset(self::$installed['versions'][$packageName]);
|
foreach (self::getInstalled() as $installed) {
|
||||||
|
if (isset($installed['versions'][$packageName])) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -215,42 +234,50 @@ return $provided->matches($constraint);
|
||||||
|
|
||||||
public static function getVersionRanges($packageName)
|
public static function getVersionRanges($packageName)
|
||||||
{
|
{
|
||||||
if (!isset(self::$installed['versions'][$packageName])) {
|
foreach (self::getInstalled() as $installed) {
|
||||||
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
|
if (!isset($installed['versions'][$packageName])) {
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$ranges = array();
|
$ranges = array();
|
||||||
if (isset(self::$installed['versions'][$packageName]['pretty_version'])) {
|
if (isset($installed['versions'][$packageName]['pretty_version'])) {
|
||||||
$ranges[] = self::$installed['versions'][$packageName]['pretty_version'];
|
$ranges[] = $installed['versions'][$packageName]['pretty_version'];
|
||||||
}
|
}
|
||||||
if (array_key_exists('aliases', self::$installed['versions'][$packageName])) {
|
if (array_key_exists('aliases', $installed['versions'][$packageName])) {
|
||||||
$ranges = array_merge($ranges, self::$installed['versions'][$packageName]['aliases']);
|
$ranges = array_merge($ranges, $installed['versions'][$packageName]['aliases']);
|
||||||
}
|
}
|
||||||
if (array_key_exists('replaced', self::$installed['versions'][$packageName])) {
|
if (array_key_exists('replaced', $installed['versions'][$packageName])) {
|
||||||
$ranges = array_merge($ranges, self::$installed['versions'][$packageName]['replaced']);
|
$ranges = array_merge($ranges, $installed['versions'][$packageName]['replaced']);
|
||||||
}
|
}
|
||||||
if (array_key_exists('provided', self::$installed['versions'][$packageName])) {
|
if (array_key_exists('provided', $installed['versions'][$packageName])) {
|
||||||
$ranges = array_merge($ranges, self::$installed['versions'][$packageName]['provided']);
|
$ranges = array_merge($ranges, $installed['versions'][$packageName]['provided']);
|
||||||
}
|
}
|
||||||
|
|
||||||
return implode(' || ', $ranges);
|
return implode(' || ', $ranges);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static function getVersion($packageName)
|
public static function getVersion($packageName)
|
||||||
{
|
{
|
||||||
if (!isset(self::$installed['versions'][$packageName])) {
|
foreach (self::getInstalled() as $installed) {
|
||||||
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
|
if (!isset($installed['versions'][$packageName])) {
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isset(self::$installed['versions'][$packageName]['version'])) {
|
if (!isset($installed['versions'][$packageName]['version'])) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return self::$installed['versions'][$packageName]['version'];
|
return $installed['versions'][$packageName]['version'];
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -259,15 +286,19 @@ return self::$installed['versions'][$packageName]['version'];
|
||||||
|
|
||||||
public static function getPrettyVersion($packageName)
|
public static function getPrettyVersion($packageName)
|
||||||
{
|
{
|
||||||
if (!isset(self::$installed['versions'][$packageName])) {
|
foreach (self::getInstalled() as $installed) {
|
||||||
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
|
if (!isset($installed['versions'][$packageName])) {
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isset(self::$installed['versions'][$packageName]['pretty_version'])) {
|
if (!isset($installed['versions'][$packageName]['pretty_version'])) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return self::$installed['versions'][$packageName]['pretty_version'];
|
return $installed['versions'][$packageName]['pretty_version'];
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -276,15 +307,19 @@ return self::$installed['versions'][$packageName]['pretty_version'];
|
||||||
|
|
||||||
public static function getReference($packageName)
|
public static function getReference($packageName)
|
||||||
{
|
{
|
||||||
if (!isset(self::$installed['versions'][$packageName])) {
|
foreach (self::getInstalled() as $installed) {
|
||||||
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
|
if (!isset($installed['versions'][$packageName])) {
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isset(self::$installed['versions'][$packageName]['reference'])) {
|
if (!isset($installed['versions'][$packageName]['reference'])) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return self::$installed['versions'][$packageName]['reference'];
|
return $installed['versions'][$packageName]['reference'];
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -293,7 +328,9 @@ return self::$installed['versions'][$packageName]['reference'];
|
||||||
|
|
||||||
public static function getRootPackage()
|
public static function getRootPackage()
|
||||||
{
|
{
|
||||||
return self::$installed['root'];
|
$installed = self::getInstalled();
|
||||||
|
|
||||||
|
return $installed[0]['root'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -328,5 +365,33 @@ return self::$installed;
|
||||||
public static function reload($data)
|
public static function reload($data)
|
||||||
{
|
{
|
||||||
self::$installed = $data;
|
self::$installed = $data;
|
||||||
|
self::$installedByVendor = array();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private static function getInstalled()
|
||||||
|
{
|
||||||
|
if (null === self::$canGetVendors) {
|
||||||
|
self::$canGetVendors = method_exists('Composer\Autoload\ClassLoader', 'getRegisteredLoaders');
|
||||||
|
}
|
||||||
|
|
||||||
|
$installed = array();
|
||||||
|
|
||||||
|
if (self::$canGetVendors) {
|
||||||
|
|
||||||
|
foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) {
|
||||||
|
if (isset(self::$installedByVendor[$vendorDir])) {
|
||||||
|
$installed[] = self::$installedByVendor[$vendorDir];
|
||||||
|
} elseif (is_file($vendorDir.'/composer/installed.php')) {
|
||||||
|
$installed[] = self::$installedByVendor[$vendorDir] = require $vendorDir.'/composer/installed.php';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$installed[] = self::$installed;
|
||||||
|
|
||||||
|
return $installed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@ class ComposerAutoloaderInit873464e4bd965a3168f133248b1b218b
|
||||||
require __DIR__ . '/platform_check.php';
|
require __DIR__ . '/platform_check.php';
|
||||||
|
|
||||||
spl_autoload_register(array('ComposerAutoloaderInit873464e4bd965a3168f133248b1b218b', 'loadClassLoader'), true, true);
|
spl_autoload_register(array('ComposerAutoloaderInit873464e4bd965a3168f133248b1b218b', 'loadClassLoader'), true, true);
|
||||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
|
||||||
spl_autoload_unregister(array('ComposerAutoloaderInit873464e4bd965a3168f133248b1b218b', 'loadClassLoader'));
|
spl_autoload_unregister(array('ComposerAutoloaderInit873464e4bd965a3168f133248b1b218b', 'loadClassLoader'));
|
||||||
|
|
||||||
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
|
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
|
||||||
|
|
|
@ -140,17 +140,17 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "matthiasmullie/minify",
|
"name": "matthiasmullie/minify",
|
||||||
"version": "1.3.65",
|
"version": "1.3.66",
|
||||||
"version_normalized": "1.3.65.0",
|
"version_normalized": "1.3.66.0",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/matthiasmullie/minify.git",
|
"url": "https://github.com/matthiasmullie/minify.git",
|
||||||
"reference": "227f19062451c55a797e0cc667ef983834e6580c"
|
"reference": "45fd3b0f1dfa2c965857c6d4a470bea52adc31a6"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/matthiasmullie/minify/zipball/227f19062451c55a797e0cc667ef983834e6580c",
|
"url": "https://api.github.com/repos/matthiasmullie/minify/zipball/45fd3b0f1dfa2c965857c6d4a470bea52adc31a6",
|
||||||
"reference": "227f19062451c55a797e0cc667ef983834e6580c",
|
"reference": "45fd3b0f1dfa2c965857c6d4a470bea52adc31a6",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
|
@ -160,13 +160,13 @@
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"friendsofphp/php-cs-fixer": "~2.0",
|
"friendsofphp/php-cs-fixer": "~2.0",
|
||||||
"matthiasmullie/scrapbook": "~1.0",
|
"matthiasmullie/scrapbook": "dev-master",
|
||||||
"phpunit/phpunit": "~4.8"
|
"phpunit/phpunit": ">=4.8"
|
||||||
},
|
},
|
||||||
"suggest": {
|
"suggest": {
|
||||||
"psr/cache-implementation": "Cache implementation to use with Minify::cache"
|
"psr/cache-implementation": "Cache implementation to use with Minify::cache"
|
||||||
},
|
},
|
||||||
"time": "2020-12-27T21:43:29+00:00",
|
"time": "2021-01-06T15:18:10+00:00",
|
||||||
"bin": [
|
"bin": [
|
||||||
"bin/minifycss",
|
"bin/minifycss",
|
||||||
"bin/minifyjs"
|
"bin/minifyjs"
|
||||||
|
@ -201,7 +201,7 @@
|
||||||
],
|
],
|
||||||
"support": {
|
"support": {
|
||||||
"issues": "https://github.com/matthiasmullie/minify/issues",
|
"issues": "https://github.com/matthiasmullie/minify/issues",
|
||||||
"source": "https://github.com/matthiasmullie/minify/tree/1.3.65"
|
"source": "https://github.com/matthiasmullie/minify/tree/1.3.66"
|
||||||
},
|
},
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
|
@ -464,17 +464,17 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "phpmailer/phpmailer",
|
"name": "phpmailer/phpmailer",
|
||||||
"version": "v6.2.0",
|
"version": "v6.3.0",
|
||||||
"version_normalized": "6.2.0.0",
|
"version_normalized": "6.3.0.0",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/PHPMailer/PHPMailer.git",
|
"url": "https://github.com/PHPMailer/PHPMailer.git",
|
||||||
"reference": "e38888a75c070304ca5514197d4847a59a5c853f"
|
"reference": "4a08cf4cdd2c38d12ee2b9fa69e5d235f37a6dcb"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/e38888a75c070304ca5514197d4847a59a5c853f",
|
"url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/4a08cf4cdd2c38d12ee2b9fa69e5d235f37a6dcb",
|
||||||
"reference": "e38888a75c070304ca5514197d4847a59a5c853f",
|
"reference": "4a08cf4cdd2c38d12ee2b9fa69e5d235f37a6dcb",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
|
@ -499,7 +499,7 @@
|
||||||
"stevenmaguire/oauth2-microsoft": "Needed for Microsoft XOAUTH2 authentication",
|
"stevenmaguire/oauth2-microsoft": "Needed for Microsoft XOAUTH2 authentication",
|
||||||
"symfony/polyfill-mbstring": "To support UTF-8 if the Mbstring PHP extension is not enabled (^1.2)"
|
"symfony/polyfill-mbstring": "To support UTF-8 if the Mbstring PHP extension is not enabled (^1.2)"
|
||||||
},
|
},
|
||||||
"time": "2020-11-25T15:24:57+00:00",
|
"time": "2021-02-19T15:28:08+00:00",
|
||||||
"type": "library",
|
"type": "library",
|
||||||
"installation-source": "dist",
|
"installation-source": "dist",
|
||||||
"autoload": {
|
"autoload": {
|
||||||
|
@ -531,7 +531,7 @@
|
||||||
"description": "PHPMailer is a full-featured email creation and transfer class for PHP",
|
"description": "PHPMailer is a full-featured email creation and transfer class for PHP",
|
||||||
"support": {
|
"support": {
|
||||||
"issues": "https://github.com/PHPMailer/PHPMailer/issues",
|
"issues": "https://github.com/PHPMailer/PHPMailer/issues",
|
||||||
"source": "https://github.com/PHPMailer/PHPMailer/tree/v6.2.0"
|
"source": "https://github.com/PHPMailer/PHPMailer/tree/v6.3.0"
|
||||||
},
|
},
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
|
|
|
@ -47,12 +47,12 @@
|
||||||
),
|
),
|
||||||
'matthiasmullie/minify' =>
|
'matthiasmullie/minify' =>
|
||||||
array (
|
array (
|
||||||
'pretty_version' => '1.3.65',
|
'pretty_version' => '1.3.66',
|
||||||
'version' => '1.3.65.0',
|
'version' => '1.3.66.0',
|
||||||
'aliases' =>
|
'aliases' =>
|
||||||
array (
|
array (
|
||||||
),
|
),
|
||||||
'reference' => '227f19062451c55a797e0cc667ef983834e6580c',
|
'reference' => '45fd3b0f1dfa2c965857c6d4a470bea52adc31a6',
|
||||||
),
|
),
|
||||||
'matthiasmullie/path-converter' =>
|
'matthiasmullie/path-converter' =>
|
||||||
array (
|
array (
|
||||||
|
@ -99,12 +99,12 @@
|
||||||
),
|
),
|
||||||
'phpmailer/phpmailer' =>
|
'phpmailer/phpmailer' =>
|
||||||
array (
|
array (
|
||||||
'pretty_version' => 'v6.2.0',
|
'pretty_version' => 'v6.3.0',
|
||||||
'version' => '6.2.0.0',
|
'version' => '6.3.0.0',
|
||||||
'aliases' =>
|
'aliases' =>
|
||||||
array (
|
array (
|
||||||
),
|
),
|
||||||
'reference' => 'e38888a75c070304ca5514197d4847a59a5c853f',
|
'reference' => '4a08cf4cdd2c38d12ee2b9fa69e5d235f37a6dcb',
|
||||||
),
|
),
|
||||||
'robthree/twofactorauth' =>
|
'robthree/twofactorauth' =>
|
||||||
array (
|
array (
|
||||||
|
|
|
@ -5,8 +5,8 @@ COPY . /var/www
|
||||||
WORKDIR /var/www
|
WORKDIR /var/www
|
||||||
|
|
||||||
RUN apt-get update
|
RUN apt-get update
|
||||||
RUN apt-get install -y zip unzip zlib1g-dev
|
RUN apt-get install -y zip unzip libzip-dev git
|
||||||
RUN if [[ `php-config --vernum` -ge 73000 ]]; then docker-php-ext-install zip; fi
|
RUN docker-php-ext-install zip
|
||||||
RUN docker-php-ext-install pcntl
|
RUN docker-php-ext-install pcntl
|
||||||
RUN curl -sS https://getcomposer.org/installer | php
|
RUN curl -sS https://getcomposer.org/installer | php
|
||||||
RUN mv composer.phar /usr/local/bin/composer
|
RUN mv composer.phar /usr/local/bin/composer
|
||||||
|
|
|
@ -19,8 +19,8 @@
|
||||||
"matthiasmullie/path-converter": "~1.1"
|
"matthiasmullie/path-converter": "~1.1"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"matthiasmullie/scrapbook": "~1.0",
|
"matthiasmullie/scrapbook": "dev-master",
|
||||||
"phpunit/phpunit": "~4.8",
|
"phpunit/phpunit": ">=4.8",
|
||||||
"friendsofphp/php-cs-fixer": "~2.0"
|
"friendsofphp/php-cs-fixer": "~2.0"
|
||||||
},
|
},
|
||||||
"suggest": {
|
"suggest": {
|
||||||
|
|
|
@ -685,7 +685,7 @@ class CSS extends Minify
|
||||||
protected function extractMath()
|
protected function extractMath()
|
||||||
{
|
{
|
||||||
$functions = array('calc', 'clamp', 'min', 'max');
|
$functions = array('calc', 'clamp', 'min', 'max');
|
||||||
$pattern = '/('. implode('|', $functions) .')(\(.+?)(?=$|;|})/m';
|
$pattern = '/\b('. implode('|', $functions) .')(\(.+?)(?=$|;|})/m';
|
||||||
|
|
||||||
// PHP only supports $this inside anonymous functions since 5.4
|
// PHP only supports $this inside anonymous functions since 5.4
|
||||||
$minifier = $this;
|
$minifier = $this;
|
||||||
|
|
|
@ -254,7 +254,7 @@ class JS extends Minify
|
||||||
// of the RegExp methods (a `\` followed by a variable or value is
|
// of the RegExp methods (a `\` followed by a variable or value is
|
||||||
// likely part of a division, not a regex)
|
// likely part of a division, not a regex)
|
||||||
$keywords = array('do', 'in', 'new', 'else', 'throw', 'yield', 'delete', 'return', 'typeof');
|
$keywords = array('do', 'in', 'new', 'else', 'throw', 'yield', 'delete', 'return', 'typeof');
|
||||||
$before = '([=:,;\+\-\*\/\}\(\{\[&\|!]|^|'.implode('|', $keywords).')\s*';
|
$before = '(^|[=:,;\+\-\*\/\}\(\{\[&\|!]|'.implode('|', $keywords).')\s*';
|
||||||
$propertiesAndMethods = array(
|
$propertiesAndMethods = array(
|
||||||
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp#Properties_2
|
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp#Properties_2
|
||||||
'constructor',
|
'constructor',
|
||||||
|
|
|
@ -472,7 +472,7 @@ abstract class Minify
|
||||||
*/
|
*/
|
||||||
protected function openFileForWriting($path)
|
protected function openFileForWriting($path)
|
||||||
{
|
{
|
||||||
if (($handler = @fopen($path, 'w')) === false) {
|
if ($path === '' || ($handler = @fopen($path, 'w')) === false) {
|
||||||
throw new IOException('The file "'.$path.'" could not be opened for writing. Check if PHP has enough permissions.');
|
throw new IOException('The file "'.$path.'" could not be opened for writing. Check if PHP has enough permissions.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -490,7 +490,11 @@ abstract class Minify
|
||||||
*/
|
*/
|
||||||
protected function writeToFile($handler, $content, $path = '')
|
protected function writeToFile($handler, $content, $path = '')
|
||||||
{
|
{
|
||||||
if (($result = @fwrite($handler, $content)) === false || ($result < strlen($content))) {
|
if (
|
||||||
|
!is_resource($handler) ||
|
||||||
|
($result = @fwrite($handler, $content)) === false ||
|
||||||
|
($result < strlen($content))
|
||||||
|
) {
|
||||||
throw new IOException('The file "'.$path.'" could not be written to. Check your disk space and file permissions.');
|
throw new IOException('The file "'.$path.'" could not be written to. Check your disk space and file permissions.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,46 +1,45 @@
|
||||||
![PHPMailer](https://raw.github.com/PHPMailer/PHPMailer/master/examples/images/phpmailer.png)
|
![PHPMailer](https://raw.github.com/PHPMailer/PHPMailer/master/examples/images/phpmailer.png)
|
||||||
|
|
||||||
# PHPMailer - A full-featured email creation and transfer class for PHP
|
# PHPMailer – A full-featured email creation and transfer class for PHP
|
||||||
|
|
||||||
Build status: [![Build Status](https://travis-ci.org/PHPMailer/PHPMailer.svg)](https://travis-ci.org/PHPMailer/PHPMailer)
|
[![Test status](https://github.com/PHPMailer/PHPMailer/workflows/Tests/badge.svg)](https://github.com/PHPMailer/PHPMailer/actions) [![Latest Stable Version](https://poser.pugx.org/phpmailer/phpmailer/v/stable.svg)](https://packagist.org/packages/phpmailer/phpmailer) [![Total Downloads](https://poser.pugx.org/phpmailer/phpmailer/downloads)](https://packagist.org/packages/phpmailer/phpmailer) [![Latest Unstable Version](https://poser.pugx.org/phpmailer/phpmailer/v/unstable.svg)](https://packagist.org/packages/phpmailer/phpmailer) [![License](https://poser.pugx.org/phpmailer/phpmailer/license.svg)](https://packagist.org/packages/phpmailer/phpmailer) [![API Docs](https://github.com/phpmailer/phpmailer/workflows/Docs/badge.svg)](https://phpmailer.github.io/PHPMailer/)
|
||||||
[![Scrutinizer Quality Score](https://scrutinizer-ci.com/g/PHPMailer/PHPMailer/badges/quality-score.png?s=3758e21d279becdf847a557a56a3ed16dfec9d5d)](https://scrutinizer-ci.com/g/PHPMailer/PHPMailer/)
|
|
||||||
[![Code Coverage](https://scrutinizer-ci.com/g/PHPMailer/PHPMailer/badges/coverage.png?s=3fe6ca5fe8cd2cdf96285756e42932f7ca256962)](https://scrutinizer-ci.com/g/PHPMailer/PHPMailer/)
|
|
||||||
|
|
||||||
[![Latest Stable Version](https://poser.pugx.org/phpmailer/phpmailer/v/stable.svg)](https://packagist.org/packages/phpmailer/phpmailer) [![Total Downloads](https://poser.pugx.org/phpmailer/phpmailer/downloads)](https://packagist.org/packages/phpmailer/phpmailer) [![Latest Unstable Version](https://poser.pugx.org/phpmailer/phpmailer/v/unstable.svg)](https://packagist.org/packages/phpmailer/phpmailer) [![License](https://poser.pugx.org/phpmailer/phpmailer/license.svg)](https://packagist.org/packages/phpmailer/phpmailer) [![API Docs](https://github.com/phpmailer/phpmailer/workflows/Docs/badge.svg)](http://phpmailer.github.io/PHPMailer/)
|
## Features
|
||||||
|
|
||||||
## Class Features
|
|
||||||
- Probably the world's most popular code for sending email from PHP!
|
- Probably the world's most popular code for sending email from PHP!
|
||||||
- Used by many open-source projects: WordPress, Drupal, 1CRM, SugarCRM, Yii, Joomla! and many more
|
- Used by many open-source projects: WordPress, Drupal, 1CRM, SugarCRM, Yii, Joomla! and many more
|
||||||
- Integrated SMTP support - send without a local mail server
|
- Integrated SMTP support – send without a local mail server
|
||||||
- Send emails with multiple To, CC, BCC and Reply-to addresses
|
- Send emails with multiple To, CC, BCC and Reply-to addresses
|
||||||
- Multipart/alternative emails for mail clients that do not read HTML email
|
- Multipart/alternative emails for mail clients that do not read HTML email
|
||||||
- Add attachments, including inline
|
- Add attachments, including inline
|
||||||
- Support for UTF-8 content and 8bit, base64, binary, and quoted-printable encodings
|
- Support for UTF-8 content and 8bit, base64, binary, and quoted-printable encodings
|
||||||
- SMTP authentication with LOGIN, PLAIN, CRAM-MD5, and XOAUTH2 mechanisms over SSL and SMTP+STARTTLS transports
|
- SMTP authentication with LOGIN, PLAIN, CRAM-MD5, and XOAUTH2 mechanisms over SMTPS and SMTP+STARTTLS transports
|
||||||
- Validates email addresses automatically
|
- Validates email addresses automatically
|
||||||
- Protect against header injection attacks
|
- Protects against header injection attacks
|
||||||
- Error messages in over 50 languages!
|
- Error messages in over 50 languages!
|
||||||
- DKIM and S/MIME signing support
|
- DKIM and S/MIME signing support
|
||||||
- Compatible with PHP 5.5 and later
|
- Compatible with PHP 5.5 and later, including PHP 8.0
|
||||||
- Namespaced to prevent name clashes
|
- Namespaced to prevent name clashes
|
||||||
- Much more!
|
- Much more!
|
||||||
|
|
||||||
## Why you might need it
|
## Why you might need it
|
||||||
Many PHP developers need to send email from their code. The only PHP function that supports this is [`mail()`](https://www.php.net/manual/en/function.mail.php). However, it does not provide any assistance for making use of popular features such as encryption, authentication, HTML messages, and attachments.
|
Many PHP developers need to send email from their code. The only PHP function that supports this directly is [`mail()`](https://www.php.net/manual/en/function.mail.php). However, it does not provide any assistance for making use of popular features such as encryption, authentication, HTML messages, and attachments.
|
||||||
|
|
||||||
Formatting email correctly is surprisingly difficult. There are myriad overlapping RFCs, requiring tight adherence to horribly complicated formatting and encoding rules – the vast majority of code that you'll find online that uses the `mail()` function directly is just plain wrong!
|
Formatting email correctly is surprisingly difficult. There are myriad overlapping (and conflicting) standards, requiring tight adherence to horribly complicated formatting and encoding rules – the vast majority of code that you'll find online that uses the `mail()` function directly is just plain wrong, if not unsafe!
|
||||||
*Please* don't be tempted to do it yourself – if you don't use PHPMailer, there are many other excellent libraries that you should look at before rolling your own. Try [SwiftMailer](https://swiftmailer.symfony.com/), [Zend/Mail](https://zendframework.github.io/zend-mail/), [ZetaComponents](https://github.com/zetacomponents/Mail) etc.
|
|
||||||
|
|
||||||
The PHP `mail()` function usually sends via a local mail server, typically fronted by a `sendmail` binary on Linux, BSD, and macOS platforms, however, Windows usually doesn't include a local mail server; PHPMailer's integrated SMTP implementation allows email sending on Windows platforms without a local mail server.
|
The PHP `mail()` function usually sends via a local mail server, typically fronted by a `sendmail` binary on Linux, BSD, and macOS platforms, however, Windows usually doesn't include a local mail server; PHPMailer's integrated SMTP client allows email sending on all platforms without needing a local mail server. Be aware though, that the `mail()` function should be avoided when possible; it's both faster and [safer](https://exploitbox.io/paper/Pwning-PHP-Mail-Function-For-Fun-And-RCE.html) to use SMTP to localhost.
|
||||||
|
|
||||||
|
*Please* don't be tempted to do it yourself – if you don't use PHPMailer, there are many other excellent libraries that
|
||||||
|
you should look at before rolling your own. Try [SwiftMailer](https://swiftmailer.symfony.com/)
|
||||||
|
, [Laminas/Mail](https://docs.laminas.dev/laminas-mail/), [ZetaComponents](https://github.com/zetacomponents/Mail) etc.
|
||||||
|
|
||||||
## License
|
## License
|
||||||
This software is distributed under the [LGPL 2.1](http://www.gnu.org/licenses/lgpl-2.1.html) license, along with the [GPL Cooperation Commitment](https://gplcc.github.io/gplcc/). Please read LICENSE for information on the software availability and distribution.
|
This software is distributed under the [LGPL 2.1](http://www.gnu.org/licenses/lgpl-2.1.html) license, along with the [GPL Cooperation Commitment](https://gplcc.github.io/gplcc/). Please read [LICENSE](https://github.com/PHPMailer/PHPMailer/blob/master/LICENSE) for information on the software availability and distribution.
|
||||||
|
|
||||||
## Installation & loading
|
## Installation & loading
|
||||||
PHPMailer is available on [Packagist](https://packagist.org/packages/phpmailer/phpmailer) (using semantic versioning), and installation via [Composer](https://getcomposer.org) is the recommended way to install PHPMailer. Just add this line to your `composer.json` file:
|
PHPMailer is available on [Packagist](https://packagist.org/packages/phpmailer/phpmailer) (using semantic versioning), and installation via [Composer](https://getcomposer.org) is the recommended way to install PHPMailer. Just add this line to your `composer.json` file:
|
||||||
|
|
||||||
```json
|
```json
|
||||||
"phpmailer/phpmailer": "~6.1"
|
"phpmailer/phpmailer": "^6.2"
|
||||||
```
|
```
|
||||||
|
|
||||||
or run
|
or run
|
||||||
|
@ -53,7 +52,8 @@ Note that the `vendor` folder and the `vendor/autoload.php` script are generated
|
||||||
|
|
||||||
If you want to use the Gmail XOAUTH2 authentication class, you will also need to add a dependency on the `league/oauth2-client` package in your `composer.json`.
|
If you want to use the Gmail XOAUTH2 authentication class, you will also need to add a dependency on the `league/oauth2-client` package in your `composer.json`.
|
||||||
|
|
||||||
Alternatively, if you're not using Composer, copy the contents of the PHPMailer folder into one of the `include_path` directories specified in your PHP configuration and load each class file manually:
|
Alternatively, if you're not using Composer, you
|
||||||
|
can [download PHPMailer as a zip file](https://github.com/PHPMailer/PHPMailer/archive/master.zip), (note that docs and examples are not included in the zip file), then copy the contents of the PHPMailer folder into one of the `include_path` directories specified in your PHP configuration and load each class file manually:
|
||||||
|
|
||||||
```php
|
```php
|
||||||
<?php
|
<?php
|
||||||
|
@ -65,60 +65,58 @@ require 'path/to/PHPMailer/src/PHPMailer.php';
|
||||||
require 'path/to/PHPMailer/src/SMTP.php';
|
require 'path/to/PHPMailer/src/SMTP.php';
|
||||||
```
|
```
|
||||||
|
|
||||||
If you're not using the `SMTP` class explicitly (you're probably not), you don't need a `use` line for the SMTP class.
|
If you're not using the `SMTP` class explicitly (you're probably not), you don't need a `use` line for the SMTP class. Even if you're not using exceptions, you do still need to load the `Exception` class as it is used internally.
|
||||||
|
|
||||||
If you don't speak git or just want a tarball, click the 'zip' button on the right of the project page in GitHub, though note that docs and examples are not included in the tarball.
|
|
||||||
|
|
||||||
## Legacy versions
|
## Legacy versions
|
||||||
PHPMailer 5.2 (which is compatible with PHP 5.0 - 7.0) is no longer being supported, even for security updates. You will find the latest version of 5.2 in the [5.2-stable branch](https://github.com/PHPMailer/PHPMailer/tree/5.2-stable). If you're using PHP 5.5 or later (which you should be), switch to the 6.x releases.
|
PHPMailer 5.2 (which is compatible with PHP 5.0 — 7.0) is no longer supported, even for security updates. You will find the latest version of 5.2 in the [5.2-stable branch](https://github.com/PHPMailer/PHPMailer/tree/5.2-stable). If you're using PHP 5.5 or later (which you should be), switch to the 6.x releases.
|
||||||
|
|
||||||
### Upgrading from 5.2
|
### Upgrading from 5.2
|
||||||
The biggest changes are that source files are now in the `src/` folder, and PHPMailer now declares the namespace `PHPMailer\PHPMailer`. This has several important effects – [read the upgrade guide](https://github.com/PHPMailer/PHPMailer/tree/master/UPGRADING.md) for more details.
|
The biggest changes are that source files are now in the `src/` folder, and PHPMailer now declares the namespace `PHPMailer\PHPMailer`. This has several important effects – [read the upgrade guide](https://github.com/PHPMailer/PHPMailer/tree/master/UPGRADING.md) for more details.
|
||||||
|
|
||||||
### Minimal installation
|
### Minimal installation
|
||||||
While installing the entire package manually or with Composer is simple, convenient, and reliable, you may want to include only vital files in your project. At the very least you will need [src/PHPMailer.php](https://github.com/PHPMailer/PHPMailer/tree/master/src/PHPMailer.php). If you're using SMTP, you'll need [src/SMTP.php](https://github.com/PHPMailer/PHPMailer/tree/master/src/SMTP.php), and if you're using POP-before SMTP, you'll need [src/POP3.php](https://github.com/PHPMailer/PHPMailer/tree/master/src/POP3.php). You can skip the [language](https://github.com/PHPMailer/PHPMailer/tree/master/language/) folder if you're not showing errors to users and can make do with English-only errors. If you're using XOAUTH2 you will need [src/OAuth.php](https://github.com/PHPMailer/PHPMailer/tree/master/src/OAuth.php) as well as the Composer dependencies for the services you wish to authenticate with. Really, it's much easier to use Composer!
|
While installing the entire package manually or with Composer is simple, convenient, and reliable, you may want to include only vital files in your project. At the very least you will need [src/PHPMailer.php](https://github.com/PHPMailer/PHPMailer/tree/master/src/PHPMailer.php). If you're using SMTP, you'll need [src/SMTP.php](https://github.com/PHPMailer/PHPMailer/tree/master/src/SMTP.php), and if you're using POP-before SMTP (*very* unlikely!), you'll need [src/POP3.php](https://github.com/PHPMailer/PHPMailer/tree/master/src/POP3.php). You can skip the [language](https://github.com/PHPMailer/PHPMailer/tree/master/language/) folder if you're not showing errors to users and can make do with English-only errors. If you're using XOAUTH2 you will need [src/OAuth.php](https://github.com/PHPMailer/PHPMailer/tree/master/src/OAuth.php) as well as the Composer dependencies for the services you wish to authenticate with. Really, it's much easier to use Composer!
|
||||||
|
|
||||||
## A Simple Example
|
## A Simple Example
|
||||||
|
|
||||||
```php
|
```php
|
||||||
<?php
|
<?php
|
||||||
// Import PHPMailer classes into the global namespace
|
//Import PHPMailer classes into the global namespace
|
||||||
// These must be at the top of your script, not inside a function
|
//These must be at the top of your script, not inside a function
|
||||||
use PHPMailer\PHPMailer\PHPMailer;
|
use PHPMailer\PHPMailer\PHPMailer;
|
||||||
use PHPMailer\PHPMailer\SMTP;
|
use PHPMailer\PHPMailer\SMTP;
|
||||||
use PHPMailer\PHPMailer\Exception;
|
use PHPMailer\PHPMailer\Exception;
|
||||||
|
|
||||||
// Load Composer's autoloader
|
//Load Composer's autoloader
|
||||||
require 'vendor/autoload.php';
|
require 'vendor/autoload.php';
|
||||||
|
|
||||||
// Instantiation and passing `true` enables exceptions
|
//Instantiation and passing `true` enables exceptions
|
||||||
$mail = new PHPMailer(true);
|
$mail = new PHPMailer(true);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
//Server settings
|
//Server settings
|
||||||
$mail->SMTPDebug = SMTP::DEBUG_SERVER; // Enable verbose debug output
|
$mail->SMTPDebug = SMTP::DEBUG_SERVER; //Enable verbose debug output
|
||||||
$mail->isSMTP(); // Send using SMTP
|
$mail->isSMTP(); //Send using SMTP
|
||||||
$mail->Host = 'smtp1.example.com'; // Set the SMTP server to send through
|
$mail->Host = 'smtp.example.com'; //Set the SMTP server to send through
|
||||||
$mail->SMTPAuth = true; // Enable SMTP authentication
|
$mail->SMTPAuth = true; //Enable SMTP authentication
|
||||||
$mail->Username = 'user@example.com'; // SMTP username
|
$mail->Username = 'user@example.com'; //SMTP username
|
||||||
$mail->Password = 'secret'; // SMTP password
|
$mail->Password = 'secret'; //SMTP password
|
||||||
$mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS; // Enable TLS encryption; `PHPMailer::ENCRYPTION_SMTPS` encouraged
|
$mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS; //Enable TLS encryption; `PHPMailer::ENCRYPTION_SMTPS` encouraged
|
||||||
$mail->Port = 587; // TCP port to connect to, use 465 for `PHPMailer::ENCRYPTION_SMTPS` above
|
$mail->Port = 587; //TCP port to connect to, use 465 for `PHPMailer::ENCRYPTION_SMTPS` above
|
||||||
|
|
||||||
//Recipients
|
//Recipients
|
||||||
$mail->setFrom('from@example.com', 'Mailer');
|
$mail->setFrom('from@example.com', 'Mailer');
|
||||||
$mail->addAddress('joe@example.net', 'Joe User'); // Add a recipient
|
$mail->addAddress('joe@example.net', 'Joe User'); //Add a recipient
|
||||||
$mail->addAddress('ellen@example.com'); // Name is optional
|
$mail->addAddress('ellen@example.com'); //Name is optional
|
||||||
$mail->addReplyTo('info@example.com', 'Information');
|
$mail->addReplyTo('info@example.com', 'Information');
|
||||||
$mail->addCC('cc@example.com');
|
$mail->addCC('cc@example.com');
|
||||||
$mail->addBCC('bcc@example.com');
|
$mail->addBCC('bcc@example.com');
|
||||||
|
|
||||||
// Attachments
|
//Attachments
|
||||||
$mail->addAttachment('/var/tmp/file.tar.gz'); // Add attachments
|
$mail->addAttachment('/var/tmp/file.tar.gz'); //Add attachments
|
||||||
$mail->addAttachment('/tmp/image.jpg', 'new.jpg'); // Optional name
|
$mail->addAttachment('/tmp/image.jpg', 'new.jpg'); //Optional name
|
||||||
|
|
||||||
// Content
|
//Content
|
||||||
$mail->isHTML(true); // Set email format to HTML
|
$mail->isHTML(true); //Set email format to HTML
|
||||||
$mail->Subject = 'Here is the subject';
|
$mail->Subject = 'Here is the subject';
|
||||||
$mail->Body = 'This is the HTML message body <b>in bold!</b>';
|
$mail->Body = 'This is the HTML message body <b>in bold!</b>';
|
||||||
$mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
|
$mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
|
||||||
|
@ -130,7 +128,7 @@ try {
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
You'll find plenty more to play with in the [examples](https://github.com/PHPMailer/PHPMailer/tree/master/examples) folder.
|
You'll find plenty to play with in the [examples](https://github.com/PHPMailer/PHPMailer/tree/master/examples) folder, which covers many common scenarios including sending through gmail, building contact forms, sending to mailing lists, and more.
|
||||||
|
|
||||||
If you are re-using the instance (e.g. when sending to a mailing list), you may need to clear the recipient list to avoid sending duplicate messages. See [the mailing list example](https://github.com/PHPMailer/PHPMailer/blob/master/examples/mailing_list.phps) for further guidance.
|
If you are re-using the instance (e.g. when sending to a mailing list), you may need to clear the recipient list to avoid sending duplicate messages. See [the mailing list example](https://github.com/PHPMailer/PHPMailer/blob/master/examples/mailing_list.phps) for further guidance.
|
||||||
|
|
||||||
|
@ -140,43 +138,43 @@ That's it. You should now be ready to use PHPMailer!
|
||||||
PHPMailer defaults to English, but in the [language](https://github.com/PHPMailer/PHPMailer/tree/master/language/) folder you'll find many translations for PHPMailer error messages that you may encounter. Their filenames contain [ISO 639-1](http://en.wikipedia.org/wiki/ISO_639-1) language code for the translations, for example `fr` for French. To specify a language, you need to tell PHPMailer which one to use, like this:
|
PHPMailer defaults to English, but in the [language](https://github.com/PHPMailer/PHPMailer/tree/master/language/) folder you'll find many translations for PHPMailer error messages that you may encounter. Their filenames contain [ISO 639-1](http://en.wikipedia.org/wiki/ISO_639-1) language code for the translations, for example `fr` for French. To specify a language, you need to tell PHPMailer which one to use, like this:
|
||||||
|
|
||||||
```php
|
```php
|
||||||
// To load the French version
|
//To load the French version
|
||||||
$mail->setLanguage('fr', '/optional/path/to/language/directory/');
|
$mail->setLanguage('fr', '/optional/path/to/language/directory/');
|
||||||
```
|
```
|
||||||
|
|
||||||
We welcome corrections and new languages - if you're looking for corrections to do, run the [PHPMailerLangTest.php](https://github.com/PHPMailer/PHPMailer/tree/master/test/PHPMailerLangTest.php) script in the tests folder and it will show any missing translations.
|
We welcome corrections and new languages – if you're looking for corrections to do, run the [PHPMailerLangTest.php](https://github.com/PHPMailer/PHPMailer/tree/master/test/PHPMailerLangTest.php) script in the tests folder and it will show any missing translations.
|
||||||
|
|
||||||
## Documentation
|
## Documentation
|
||||||
Start reading at the [GitHub wiki](https://github.com/PHPMailer/PHPMailer/wiki). If you're having trouble, this should be the first place you look as it's the most frequently updated.
|
Start reading at the [GitHub wiki](https://github.com/PHPMailer/PHPMailer/wiki). If you're having trouble, head for [the troubleshooting guide](https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting) as it's frequently updated.
|
||||||
|
|
||||||
Examples of how to use PHPMailer for common scenarios can be found in the [examples](https://github.com/PHPMailer/PHPMailer/tree/master/examples) folder. If you're looking for a good starting point, we recommend you start with [the Gmail example](https://github.com/PHPMailer/PHPMailer/tree/master/examples/gmail.phps).
|
Examples of how to use PHPMailer for common scenarios can be found in the [examples](https://github.com/PHPMailer/PHPMailer/tree/master/examples) folder. If you're looking for a good starting point, we recommend you start with [the Gmail example](https://github.com/PHPMailer/PHPMailer/tree/master/examples/gmail.phps).
|
||||||
|
|
||||||
Note that in order to reduce PHPMailer's deployed code footprint, the examples are no longer included if you load PHPMailer via Composer or via [GitHub's zip file download](https://github.com/PHPMailer/PHPMailer/archive/master.zip), so you'll need to either clone the git repository or use the above links to get to the examples directly.
|
To reduce PHPMailer's deployed code footprint, examples are not included if you load PHPMailer via Composer or via [GitHub's zip file download](https://github.com/PHPMailer/PHPMailer/archive/master.zip), so you'll need to either clone the git repository or use the above links to get to the examples directly.
|
||||||
|
|
||||||
Complete generated API documentation is [available online](http://phpmailer.github.io/PHPMailer/).
|
Complete generated API documentation is [available online](https://phpmailer.github.io/PHPMailer/).
|
||||||
|
|
||||||
You can generate complete API-level documentation by running `phpdoc` in the top-level folder, and documentation will appear in the `docs` folder, though you'll need to have [PHPDocumentor](http://www.phpdoc.org) installed. You may find [the unit tests](https://github.com/PHPMailer/PHPMailer/blob/master/test/PHPMailerTest.php) a good source of how to do various operations such as encryption.
|
You can generate complete API-level documentation by running `phpdoc` in the top-level folder, and documentation will appear in the `docs` folder, though you'll need to have [PHPDocumentor](http://www.phpdoc.org) installed. You may find [the unit tests](https://github.com/PHPMailer/PHPMailer/blob/master/test/PHPMailerTest.php) a good reference for how to do various operations such as encryption.
|
||||||
|
|
||||||
If the documentation doesn't cover what you need, search the [many questions on Stack Overflow](http://stackoverflow.com/questions/tagged/phpmailer), and before you ask a question about "SMTP Error: Could not connect to SMTP host.", [read the troubleshooting guide](https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting).
|
If the documentation doesn't cover what you need, search the [many questions on Stack Overflow](http://stackoverflow.com/questions/tagged/phpmailer), and before you ask a question about "SMTP Error: Could not connect to SMTP host.", [read the troubleshooting guide](https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting).
|
||||||
|
|
||||||
## Tests
|
## Tests
|
||||||
There is a PHPUnit test script in the [test](https://github.com/PHPMailer/PHPMailer/tree/master/test/) folder. PHPMailer uses PHPUnit 4.8 - we would use 5.x but we need to run on PHP 5.5.
|
[PHPMailer tests](https://github.com/PHPMailer/PHPMailer/tree/master/test/) use PHPUnit 9, with [a polyfill](https://github.com/Yoast/PHPUnit-Polyfills) to let 9-style tests run on older PHPUnit and PHP versions.
|
||||||
|
|
||||||
Build status: [![Build Status](https://travis-ci.org/PHPMailer/PHPMailer.svg)](https://travis-ci.org/PHPMailer/PHPMailer)
|
[![Test status](https://github.com/PHPMailer/PHPMailer/workflows/Tests/badge.svg)](https://github.com/PHPMailer/PHPMailer/actions)
|
||||||
|
|
||||||
If this isn't passing, is there something you can do to help?
|
If this isn't passing, is there something you can do to help?
|
||||||
|
|
||||||
## Security
|
## Security
|
||||||
Please disclose any vulnerabilities found responsibly – report security issues to the maintainers privately.
|
Please disclose any vulnerabilities found responsibly – report security issues to the maintainers privately.
|
||||||
|
|
||||||
See [SECURITY](https://github.com/PHPMailer/PHPMailer/tree/master/SECURITY.md) for details on security issues.
|
See [SECURITY](https://github.com/PHPMailer/PHPMailer/tree/master/SECURITY.md) and [PHPMailer's security advisories on GitHub](https://github.com/PHPMailer/PHPMailer/security).
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
Please submit bug reports, suggestions and pull requests to the [GitHub issue tracker](https://github.com/PHPMailer/PHPMailer/issues).
|
Please submit bug reports, suggestions and pull requests to the [GitHub issue tracker](https://github.com/PHPMailer/PHPMailer/issues).
|
||||||
|
|
||||||
We're particularly interested in fixing edge-cases, expanding test coverage and updating translations.
|
We're particularly interested in fixing edge-cases, expanding test coverage and updating translations.
|
||||||
|
|
||||||
If you found a mistake in the docs, or want to add something, go ahead and amend the wiki - anyone can edit it.
|
If you found a mistake in the docs, or want to add something, go ahead and amend the wiki – anyone can edit it.
|
||||||
|
|
||||||
If you have git clones from prior to the move to the PHPMailer GitHub organisation, you'll need to update any remote URLs referencing the old GitHub location with a command like this from within your clone:
|
If you have git clones from prior to the move to the PHPMailer GitHub organisation, you'll need to update any remote URLs referencing the old GitHub location with a command like this from within your clone:
|
||||||
|
|
||||||
|
@ -187,27 +185,28 @@ git remote set-url upstream https://github.com/PHPMailer/PHPMailer.git
|
||||||
Please *don't* use the SourceForge or Google Code projects any more; they are obsolete and no longer maintained.
|
Please *don't* use the SourceForge or Google Code projects any more; they are obsolete and no longer maintained.
|
||||||
|
|
||||||
## Sponsorship
|
## Sponsorship
|
||||||
Development time and resources for PHPMailer are provided by [Smartmessages.net](https://info.smartmessages.net/), a powerful email marketing system.
|
Development time and resources for PHPMailer are provided by [Smartmessages.net](https://info.smartmessages.net/), the world's only privacy-first email marketing system.
|
||||||
|
|
||||||
<a href="https://info.smartmessages.net/"><img src="https://www.smartmessages.net/img/smartmessages-logo.svg" width="250" height="28" alt="Smartmessages email marketing"></a>
|
<a href="https://info.smartmessages.net/"><img src="https://www.smartmessages.net/img/smartmessages-logo.svg" width="550" alt="Smartmessages.net privacy-first email marketing logo"></a>
|
||||||
|
|
||||||
Other contributions are gladly received, whether in beer 🍺, T-shirts 👕, Amazon wishlist raids, or cold, hard cash 💰. If you'd like to donate to say "thank you" to maintainers or contributors, please contact them through individual profile pages via [the contributors page](https://github.com/PHPMailer/PHPMailer/graphs/contributors).
|
|
||||||
|
Contributions are very welcome, whether in beer 🍺, T-shirts 👕, or cold, hard cash 💰. Sponsorship through GitHub is a simple and convenient way to say "thank you" to PHPMailer's maintainers and contributors – just click the "Sponsor" button [on the project page](https://github.com/PHPMailer/PHPMailer).
|
||||||
|
|
||||||
## Changelog
|
## Changelog
|
||||||
See [changelog](changelog.md).
|
See [changelog](changelog.md).
|
||||||
|
|
||||||
## History
|
## History
|
||||||
- PHPMailer was originally written in 2001 by Brent R. Matzelle as a [SourceForge project](http://sourceforge.net/projects/phpmailer/).
|
- PHPMailer was originally written in 2001 by Brent R. Matzelle as a [SourceForge project](http://sourceforge.net/projects/phpmailer/).
|
||||||
- Marcus Bointon (coolbru on SF) and Andy Prevost (codeworxtech) took over the project in 2004.
|
- [Marcus Bointon](https://github.com/Synchro) (`coolbru` on SF) and Andy Prevost (`codeworxtech`) took over the project in 2004.
|
||||||
- Became an Apache incubator project on Google Code in 2010, managed by Jim Jagielski.
|
- Became an Apache incubator project on Google Code in 2010, managed by Jim Jagielski.
|
||||||
- Marcus created his fork on [GitHub](https://github.com/Synchro/PHPMailer) in 2008.
|
- Marcus created [his fork on GitHub](https://github.com/Synchro/PHPMailer) in 2008.
|
||||||
- Jim and Marcus decide to join forces and use GitHub as the canonical and official repo for PHPMailer in 2013.
|
- Jim and Marcus decide to join forces and use GitHub as the canonical and official repo for PHPMailer in 2013.
|
||||||
- PHPMailer moves to the [PHPMailer organisation](https://github.com/PHPMailer) on GitHub in 2013.
|
- PHPMailer moves to [the PHPMailer organisation](https://github.com/PHPMailer) on GitHub in 2013.
|
||||||
|
|
||||||
### What's changed since moving from SourceForge?
|
### What's changed since moving from SourceForge?
|
||||||
- Official successor to the SourceForge and Google Code projects.
|
- Official successor to the SourceForge and Google Code projects.
|
||||||
- Test suite.
|
- Test suite.
|
||||||
- Continuous integration with Travis-CI.
|
- Continuous integration with Github Actions.
|
||||||
- Composer support.
|
- Composer support.
|
||||||
- Public development.
|
- Public development.
|
||||||
- Additional languages and language strings.
|
- Additional languages and language strings.
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
6.2.0
|
6.3.0
|
|
@ -38,11 +38,11 @@ namespace PHPMailer\PHPMailer;
|
||||||
* Plenty to choose from here:
|
* Plenty to choose from here:
|
||||||
* @see http://oauth2-client.thephpleague.com/providers/thirdparty/
|
* @see http://oauth2-client.thephpleague.com/providers/thirdparty/
|
||||||
*/
|
*/
|
||||||
// @see https://github.com/thephpleague/oauth2-google
|
//@see https://github.com/thephpleague/oauth2-google
|
||||||
use League\OAuth2\Client\Provider\Google;
|
use League\OAuth2\Client\Provider\Google;
|
||||||
// @see https://packagist.org/packages/hayageek/oauth2-yahoo
|
//@see https://packagist.org/packages/hayageek/oauth2-yahoo
|
||||||
use Hayageek\OAuth2\Client\Provider\Yahoo;
|
use Hayageek\OAuth2\Client\Provider\Yahoo;
|
||||||
// @see https://github.com/stevenmaguire/oauth2-microsoft
|
//@see https://github.com/stevenmaguire/oauth2-microsoft
|
||||||
use Stevenmaguire\OAuth2\Client\Provider\Microsoft;
|
use Stevenmaguire\OAuth2\Client\Provider\Microsoft;
|
||||||
|
|
||||||
if (!isset($_GET['code']) && !isset($_GET['provider'])) {
|
if (!isset($_GET['code']) && !isset($_GET['provider'])) {
|
||||||
|
@ -121,26 +121,26 @@ if (null === $provider) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isset($_GET['code'])) {
|
if (!isset($_GET['code'])) {
|
||||||
// If we don't have an authorization code then get one
|
//If we don't have an authorization code then get one
|
||||||
$authUrl = $provider->getAuthorizationUrl($options);
|
$authUrl = $provider->getAuthorizationUrl($options);
|
||||||
$_SESSION['oauth2state'] = $provider->getState();
|
$_SESSION['oauth2state'] = $provider->getState();
|
||||||
header('Location: ' . $authUrl);
|
header('Location: ' . $authUrl);
|
||||||
exit;
|
exit;
|
||||||
// Check given state against previously stored one to mitigate CSRF attack
|
//Check given state against previously stored one to mitigate CSRF attack
|
||||||
} elseif (empty($_GET['state']) || ($_GET['state'] !== $_SESSION['oauth2state'])) {
|
} elseif (empty($_GET['state']) || ($_GET['state'] !== $_SESSION['oauth2state'])) {
|
||||||
unset($_SESSION['oauth2state']);
|
unset($_SESSION['oauth2state']);
|
||||||
unset($_SESSION['provider']);
|
unset($_SESSION['provider']);
|
||||||
exit('Invalid state');
|
exit('Invalid state');
|
||||||
} else {
|
} else {
|
||||||
unset($_SESSION['provider']);
|
unset($_SESSION['provider']);
|
||||||
// Try to get an access token (using the authorization code grant)
|
//Try to get an access token (using the authorization code grant)
|
||||||
$token = $provider->getAccessToken(
|
$token = $provider->getAccessToken(
|
||||||
'authorization_code',
|
'authorization_code',
|
||||||
[
|
[
|
||||||
'code' => $_GET['code']
|
'code' => $_GET['code']
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
// Use this to interact with an API on the users behalf
|
//Use this to interact with an API on the users behalf
|
||||||
// Use this to get a new access token if the old one expires
|
//Use this to get a new access token if the old one expires
|
||||||
echo 'Refresh Token: ', $token->getRefreshToken();
|
echo 'Refresh Token: ', $token->getRefreshToken();
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,8 @@ $PHPMAILER_LANG['file_open'] = 'Chyba souboru: Nelze otevřít soubor
|
||||||
$PHPMAILER_LANG['from_failed'] = 'Následující adresa odesílatele je nesprávná: ';
|
$PHPMAILER_LANG['from_failed'] = 'Následující adresa odesílatele je nesprávná: ';
|
||||||
$PHPMAILER_LANG['instantiate'] = 'Nelze vytvořit instanci emailové funkce.';
|
$PHPMAILER_LANG['instantiate'] = 'Nelze vytvořit instanci emailové funkce.';
|
||||||
$PHPMAILER_LANG['invalid_address'] = 'Neplatná adresa: ';
|
$PHPMAILER_LANG['invalid_address'] = 'Neplatná adresa: ';
|
||||||
|
$PHPMAILER_LANG['invalid_hostentry'] = 'Záznam hostitele je nesprávný: ';
|
||||||
|
$PHPMAILER_LANG['invalid_host'] = 'Hostitel je nesprávný: ';
|
||||||
$PHPMAILER_LANG['mailer_not_supported'] = ' mailer není podporován.';
|
$PHPMAILER_LANG['mailer_not_supported'] = ' mailer není podporován.';
|
||||||
$PHPMAILER_LANG['provide_address'] = 'Musíte zadat alespoň jednu emailovou adresu příjemce.';
|
$PHPMAILER_LANG['provide_address'] = 'Musíte zadat alespoň jednu emailovou adresu příjemce.';
|
||||||
$PHPMAILER_LANG['recipients_failed'] = 'Chyba SMTP: Následující adresy příjemců nejsou správně: ';
|
$PHPMAILER_LANG['recipients_failed'] = 'Chyba SMTP: Následující adresy příjemců nejsou správně: ';
|
||||||
|
|
|
@ -18,6 +18,8 @@ $PHPMAILER_LANG['file_open'] = 'File Error: Súbor sa otvoriť pre č
|
||||||
$PHPMAILER_LANG['from_failed'] = 'Následujúca adresa From je nesprávna: ';
|
$PHPMAILER_LANG['from_failed'] = 'Následujúca adresa From je nesprávna: ';
|
||||||
$PHPMAILER_LANG['instantiate'] = 'Nedá sa vytvoriť inštancia emailovej funkcie.';
|
$PHPMAILER_LANG['instantiate'] = 'Nedá sa vytvoriť inštancia emailovej funkcie.';
|
||||||
$PHPMAILER_LANG['invalid_address'] = 'Neodoslané, emailová adresa je nesprávna: ';
|
$PHPMAILER_LANG['invalid_address'] = 'Neodoslané, emailová adresa je nesprávna: ';
|
||||||
|
$PHPMAILER_LANG['invalid_hostentry'] = 'Záznam hostiteľa je nesprávny: ';
|
||||||
|
$PHPMAILER_LANG['invalid_host'] = 'Hostiteľ je nesprávny: ';
|
||||||
$PHPMAILER_LANG['mailer_not_supported'] = ' emailový klient nieje podporovaný.';
|
$PHPMAILER_LANG['mailer_not_supported'] = ' emailový klient nieje podporovaný.';
|
||||||
$PHPMAILER_LANG['provide_address'] = 'Musíte zadať aspoň jednu emailovú adresu príjemcu.';
|
$PHPMAILER_LANG['provide_address'] = 'Musíte zadať aspoň jednu emailovú adresu príjemcu.';
|
||||||
$PHPMAILER_LANG['recipients_failed'] = 'SMTP Error: Adresy príjemcov niesu správne ';
|
$PHPMAILER_LANG['recipients_failed'] = 'SMTP Error: Adresy príjemcov niesu správne ';
|
||||||
|
|
|
@ -0,0 +1,35 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<phpunit
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/8.5/phpunit.xsd"
|
||||||
|
backupGlobals="true"
|
||||||
|
bootstrap="vendor/autoload.php"
|
||||||
|
verbose="true"
|
||||||
|
colors="true"
|
||||||
|
forceCoversAnnotation="false"
|
||||||
|
>
|
||||||
|
<testsuites>
|
||||||
|
<testsuite name="PHPMailerTests">
|
||||||
|
<directory>./test/</directory>
|
||||||
|
</testsuite>
|
||||||
|
</testsuites>
|
||||||
|
<listeners>
|
||||||
|
<listener class="PHPMailer\Test\DebugLogTestListener" />
|
||||||
|
</listeners>
|
||||||
|
<groups>
|
||||||
|
<exclude>
|
||||||
|
<group>languages</group>
|
||||||
|
<group>pop3</group>
|
||||||
|
</exclude>
|
||||||
|
</groups>
|
||||||
|
<filter>
|
||||||
|
<whitelist addUncoveredFilesFromWhitelist="true">
|
||||||
|
<directory suffix=".php">./src</directory>
|
||||||
|
</whitelist>
|
||||||
|
</filter>
|
||||||
|
<logging>
|
||||||
|
<log type="coverage-text" target="php://stdout" showUncoveredFiles="true"/>
|
||||||
|
<log type="coverage-clover" target="build/logs/clover.xml"/>
|
||||||
|
<log type="junit" target="build/logs/junit.xml"/>
|
||||||
|
</logging>
|
||||||
|
</phpunit>
|
|
@ -123,7 +123,7 @@ class OAuth
|
||||||
*/
|
*/
|
||||||
public function getOauth64()
|
public function getOauth64()
|
||||||
{
|
{
|
||||||
// Get a new token if it's not available or has expired
|
//Get a new token if it's not available or has expired
|
||||||
if (null === $this->oauthToken || $this->oauthToken->hasExpired()) {
|
if (null === $this->oauthToken || $this->oauthToken->hasExpired()) {
|
||||||
$this->oauthToken = $this->getToken();
|
$this->oauthToken = $this->getToken();
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -46,7 +46,7 @@ class POP3
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
const VERSION = '6.2.0';
|
const VERSION = '6.3.0';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default POP3 port number.
|
* Default POP3 port number.
|
||||||
|
@ -199,13 +199,13 @@ class POP3
|
||||||
public function authorise($host, $port = false, $timeout = false, $username = '', $password = '', $debug_level = 0)
|
public function authorise($host, $port = false, $timeout = false, $username = '', $password = '', $debug_level = 0)
|
||||||
{
|
{
|
||||||
$this->host = $host;
|
$this->host = $host;
|
||||||
// If no port value provided, use default
|
//If no port value provided, use default
|
||||||
if (false === $port) {
|
if (false === $port) {
|
||||||
$this->port = static::DEFAULT_PORT;
|
$this->port = static::DEFAULT_PORT;
|
||||||
} else {
|
} else {
|
||||||
$this->port = (int) $port;
|
$this->port = (int) $port;
|
||||||
}
|
}
|
||||||
// If no timeout value provided, use default
|
//If no timeout value provided, use default
|
||||||
if (false === $timeout) {
|
if (false === $timeout) {
|
||||||
$this->tval = static::DEFAULT_TIMEOUT;
|
$this->tval = static::DEFAULT_TIMEOUT;
|
||||||
} else {
|
} else {
|
||||||
|
@ -214,9 +214,9 @@ class POP3
|
||||||
$this->do_debug = $debug_level;
|
$this->do_debug = $debug_level;
|
||||||
$this->username = $username;
|
$this->username = $username;
|
||||||
$this->password = $password;
|
$this->password = $password;
|
||||||
// Reset the error log
|
//Reset the error log
|
||||||
$this->errors = [];
|
$this->errors = [];
|
||||||
// connect
|
//Connect
|
||||||
$result = $this->connect($this->host, $this->port, $this->tval);
|
$result = $this->connect($this->host, $this->port, $this->tval);
|
||||||
if ($result) {
|
if ($result) {
|
||||||
$login_result = $this->login($this->username, $this->password);
|
$login_result = $this->login($this->username, $this->password);
|
||||||
|
@ -226,7 +226,7 @@ class POP3
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// We need to disconnect regardless of whether the login succeeded
|
//We need to disconnect regardless of whether the login succeeded
|
||||||
$this->disconnect();
|
$this->disconnect();
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -243,7 +243,7 @@ class POP3
|
||||||
*/
|
*/
|
||||||
public function connect($host, $port = false, $tval = 30)
|
public function connect($host, $port = false, $tval = 30)
|
||||||
{
|
{
|
||||||
// Are we already connected?
|
//Are we already connected?
|
||||||
if ($this->connected) {
|
if ($this->connected) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -256,22 +256,22 @@ class POP3
|
||||||
$port = static::DEFAULT_PORT;
|
$port = static::DEFAULT_PORT;
|
||||||
}
|
}
|
||||||
|
|
||||||
// connect to the POP3 server
|
//Connect to the POP3 server
|
||||||
$errno = 0;
|
$errno = 0;
|
||||||
$errstr = '';
|
$errstr = '';
|
||||||
$this->pop_conn = fsockopen(
|
$this->pop_conn = fsockopen(
|
||||||
$host, // POP3 Host
|
$host, //POP3 Host
|
||||||
$port, // Port #
|
$port, //Port #
|
||||||
$errno, // Error Number
|
$errno, //Error Number
|
||||||
$errstr, // Error Message
|
$errstr, //Error Message
|
||||||
$tval
|
$tval
|
||||||
); // Timeout (seconds)
|
); //Timeout (seconds)
|
||||||
// Restore the error handler
|
//Restore the error handler
|
||||||
restore_error_handler();
|
restore_error_handler();
|
||||||
|
|
||||||
// Did we connect?
|
//Did we connect?
|
||||||
if (false === $this->pop_conn) {
|
if (false === $this->pop_conn) {
|
||||||
// It would appear not...
|
//It would appear not...
|
||||||
$this->setError(
|
$this->setError(
|
||||||
"Failed to connect to server $host on port $port. errno: $errno; errstr: $errstr"
|
"Failed to connect to server $host on port $port. errno: $errno; errstr: $errstr"
|
||||||
);
|
);
|
||||||
|
@ -279,14 +279,14 @@ class POP3
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Increase the stream time-out
|
//Increase the stream time-out
|
||||||
stream_set_timeout($this->pop_conn, $tval, 0);
|
stream_set_timeout($this->pop_conn, $tval, 0);
|
||||||
|
|
||||||
// Get the POP3 server response
|
//Get the POP3 server response
|
||||||
$pop3_response = $this->getResponse();
|
$pop3_response = $this->getResponse();
|
||||||
// Check for the +OK
|
//Check for the +OK
|
||||||
if ($this->checkResponse($pop3_response)) {
|
if ($this->checkResponse($pop3_response)) {
|
||||||
// The connection is established and the POP3 server is talking
|
//The connection is established and the POP3 server is talking
|
||||||
$this->connected = true;
|
$this->connected = true;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -316,11 +316,11 @@ class POP3
|
||||||
$password = $this->password;
|
$password = $this->password;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send the Username
|
//Send the Username
|
||||||
$this->sendString("USER $username" . static::LE);
|
$this->sendString("USER $username" . static::LE);
|
||||||
$pop3_response = $this->getResponse();
|
$pop3_response = $this->getResponse();
|
||||||
if ($this->checkResponse($pop3_response)) {
|
if ($this->checkResponse($pop3_response)) {
|
||||||
// Send the Password
|
//Send the Password
|
||||||
$this->sendString("PASS $password" . static::LE);
|
$this->sendString("PASS $password" . static::LE);
|
||||||
$pop3_response = $this->getResponse();
|
$pop3_response = $this->getResponse();
|
||||||
if ($this->checkResponse($pop3_response)) {
|
if ($this->checkResponse($pop3_response)) {
|
||||||
|
|
|
@ -35,7 +35,7 @@ class SMTP
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
const VERSION = '6.2.0';
|
const VERSION = '6.3.0';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SMTP line break constant.
|
* SMTP line break constant.
|
||||||
|
@ -312,11 +312,11 @@ class SMTP
|
||||||
*/
|
*/
|
||||||
public function connect($host, $port = null, $timeout = 30, $options = [])
|
public function connect($host, $port = null, $timeout = 30, $options = [])
|
||||||
{
|
{
|
||||||
// Clear errors to avoid confusion
|
//Clear errors to avoid confusion
|
||||||
$this->setError('');
|
$this->setError('');
|
||||||
// Make sure we are __not__ connected
|
//Make sure we are __not__ connected
|
||||||
if ($this->connected()) {
|
if ($this->connected()) {
|
||||||
// Already connected, generate error
|
//Already connected, generate error
|
||||||
$this->setError('Already connected to a server');
|
$this->setError('Already connected to a server');
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -324,7 +324,7 @@ class SMTP
|
||||||
if (empty($port)) {
|
if (empty($port)) {
|
||||||
$port = self::DEFAULT_PORT;
|
$port = self::DEFAULT_PORT;
|
||||||
}
|
}
|
||||||
// Connect to the SMTP server
|
//Connect to the SMTP server
|
||||||
$this->edebug(
|
$this->edebug(
|
||||||
"Connection: opening to $host:$port, timeout=$timeout, options=" .
|
"Connection: opening to $host:$port, timeout=$timeout, options=" .
|
||||||
(count($options) > 0 ? var_export($options, true) : 'array()'),
|
(count($options) > 0 ? var_export($options, true) : 'array()'),
|
||||||
|
@ -340,12 +340,24 @@ class SMTP
|
||||||
|
|
||||||
$this->edebug('Connection: opened', self::DEBUG_CONNECTION);
|
$this->edebug('Connection: opened', self::DEBUG_CONNECTION);
|
||||||
|
|
||||||
// Get any announcement
|
//Get any announcement
|
||||||
$this->last_reply = $this->get_lines();
|
$this->last_reply = $this->get_lines();
|
||||||
$this->edebug('SERVER -> CLIENT: ' . $this->last_reply, self::DEBUG_SERVER);
|
$this->edebug('SERVER -> CLIENT: ' . $this->last_reply, self::DEBUG_SERVER);
|
||||||
|
$responseCode = (int)substr($this->last_reply, 0, 3);
|
||||||
|
if ($responseCode === 220) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
//Anything other than a 220 response means something went wrong
|
||||||
|
//RFC 5321 says the server will wait for us to send a QUIT in response to a 554 error
|
||||||
|
//https://tools.ietf.org/html/rfc5321#section-3.1
|
||||||
|
if ($responseCode === 554) {
|
||||||
|
$this->quit();
|
||||||
|
}
|
||||||
|
//This will handle 421 responses which may not wait for a QUIT (e.g. if the server is being shut down)
|
||||||
|
$this->edebug('Connection: closing due to error', self::DEBUG_CONNECTION);
|
||||||
|
$this->close();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create connection to the SMTP server.
|
* Create connection to the SMTP server.
|
||||||
|
@ -397,7 +409,7 @@ class SMTP
|
||||||
restore_error_handler();
|
restore_error_handler();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Verify we connected properly
|
//Verify we connected properly
|
||||||
if (!is_resource($connection)) {
|
if (!is_resource($connection)) {
|
||||||
$this->setError(
|
$this->setError(
|
||||||
'Failed to connect to server',
|
'Failed to connect to server',
|
||||||
|
@ -414,11 +426,11 @@ class SMTP
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// SMTP server can take longer to respond, give longer timeout for first read
|
//SMTP server can take longer to respond, give longer timeout for first read
|
||||||
// Windows does not have support for this timeout function
|
//Windows does not have support for this timeout function
|
||||||
if (strpos(PHP_OS, 'WIN') !== 0) {
|
if (strpos(PHP_OS, 'WIN') !== 0) {
|
||||||
$max = (int)ini_get('max_execution_time');
|
$max = (int)ini_get('max_execution_time');
|
||||||
// Don't bother if unlimited, or if set_time_limit is disabled
|
//Don't bother if unlimited, or if set_time_limit is disabled
|
||||||
if (0 !== $max && $timeout > $max && strpos(ini_get('disable_functions'), 'set_time_limit') === false) {
|
if (0 !== $max && $timeout > $max && strpos(ini_get('disable_functions'), 'set_time_limit') === false) {
|
||||||
@set_time_limit($timeout);
|
@set_time_limit($timeout);
|
||||||
}
|
}
|
||||||
|
@ -449,7 +461,7 @@ class SMTP
|
||||||
$crypto_method |= STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT;
|
$crypto_method |= STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Begin encrypted connection
|
//Begin encrypted connection
|
||||||
set_error_handler([$this, 'errorHandler']);
|
set_error_handler([$this, 'errorHandler']);
|
||||||
$crypto_ok = stream_socket_enable_crypto(
|
$crypto_ok = stream_socket_enable_crypto(
|
||||||
$this->smtp_conn,
|
$this->smtp_conn,
|
||||||
|
@ -487,11 +499,11 @@ class SMTP
|
||||||
}
|
}
|
||||||
|
|
||||||
if (array_key_exists('EHLO', $this->server_caps)) {
|
if (array_key_exists('EHLO', $this->server_caps)) {
|
||||||
// SMTP extensions are available; try to find a proper authentication method
|
//SMTP extensions are available; try to find a proper authentication method
|
||||||
if (!array_key_exists('AUTH', $this->server_caps)) {
|
if (!array_key_exists('AUTH', $this->server_caps)) {
|
||||||
$this->setError('Authentication is not allowed at this stage');
|
$this->setError('Authentication is not allowed at this stage');
|
||||||
// 'at this stage' means that auth may be allowed after the stage changes
|
//'at this stage' means that auth may be allowed after the stage changes
|
||||||
// e.g. after STARTTLS
|
//e.g. after STARTTLS
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -535,11 +547,11 @@ class SMTP
|
||||||
}
|
}
|
||||||
switch ($authtype) {
|
switch ($authtype) {
|
||||||
case 'PLAIN':
|
case 'PLAIN':
|
||||||
// Start authentication
|
//Start authentication
|
||||||
if (!$this->sendCommand('AUTH', 'AUTH PLAIN', 334)) {
|
if (!$this->sendCommand('AUTH', 'AUTH PLAIN', 334)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// Send encoded username and password
|
//Send encoded username and password
|
||||||
if (
|
if (
|
||||||
!$this->sendCommand(
|
!$this->sendCommand(
|
||||||
'User & Password',
|
'User & Password',
|
||||||
|
@ -551,7 +563,7 @@ class SMTP
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'LOGIN':
|
case 'LOGIN':
|
||||||
// Start authentication
|
//Start authentication
|
||||||
if (!$this->sendCommand('AUTH', 'AUTH LOGIN', 334)) {
|
if (!$this->sendCommand('AUTH', 'AUTH LOGIN', 334)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -563,17 +575,17 @@ class SMTP
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'CRAM-MD5':
|
case 'CRAM-MD5':
|
||||||
// Start authentication
|
//Start authentication
|
||||||
if (!$this->sendCommand('AUTH CRAM-MD5', 'AUTH CRAM-MD5', 334)) {
|
if (!$this->sendCommand('AUTH CRAM-MD5', 'AUTH CRAM-MD5', 334)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// Get the challenge
|
//Get the challenge
|
||||||
$challenge = base64_decode(substr($this->last_reply, 4));
|
$challenge = base64_decode(substr($this->last_reply, 4));
|
||||||
|
|
||||||
// Build the response
|
//Build the response
|
||||||
$response = $username . ' ' . $this->hmac($challenge, $password);
|
$response = $username . ' ' . $this->hmac($challenge, $password);
|
||||||
|
|
||||||
// send encoded credentials
|
//send encoded credentials
|
||||||
return $this->sendCommand('Username', base64_encode($response), 235);
|
return $this->sendCommand('Username', base64_encode($response), 235);
|
||||||
case 'XOAUTH2':
|
case 'XOAUTH2':
|
||||||
//The OAuth instance must be set up prior to requesting auth.
|
//The OAuth instance must be set up prior to requesting auth.
|
||||||
|
@ -582,7 +594,7 @@ class SMTP
|
||||||
}
|
}
|
||||||
$oauth = $OAuth->getOauth64();
|
$oauth = $OAuth->getOauth64();
|
||||||
|
|
||||||
// Start authentication
|
//Start authentication
|
||||||
if (!$this->sendCommand('AUTH', 'AUTH XOAUTH2 ' . $oauth, 235)) {
|
if (!$this->sendCommand('AUTH', 'AUTH XOAUTH2 ' . $oauth, 235)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -612,15 +624,15 @@ class SMTP
|
||||||
return hash_hmac('md5', $data, $key);
|
return hash_hmac('md5', $data, $key);
|
||||||
}
|
}
|
||||||
|
|
||||||
// The following borrowed from
|
//The following borrowed from
|
||||||
// http://php.net/manual/en/function.mhash.php#27225
|
//http://php.net/manual/en/function.mhash.php#27225
|
||||||
|
|
||||||
// RFC 2104 HMAC implementation for php.
|
//RFC 2104 HMAC implementation for php.
|
||||||
// Creates an md5 HMAC.
|
//Creates an md5 HMAC.
|
||||||
// Eliminates the need to install mhash to compute a HMAC
|
//Eliminates the need to install mhash to compute a HMAC
|
||||||
// by Lance Rushing
|
//by Lance Rushing
|
||||||
|
|
||||||
$bytelen = 64; // byte length for md5
|
$bytelen = 64; //byte length for md5
|
||||||
if (strlen($key) > $bytelen) {
|
if (strlen($key) > $bytelen) {
|
||||||
$key = pack('H*', md5($key));
|
$key = pack('H*', md5($key));
|
||||||
}
|
}
|
||||||
|
@ -643,7 +655,7 @@ class SMTP
|
||||||
if (is_resource($this->smtp_conn)) {
|
if (is_resource($this->smtp_conn)) {
|
||||||
$sock_status = stream_get_meta_data($this->smtp_conn);
|
$sock_status = stream_get_meta_data($this->smtp_conn);
|
||||||
if ($sock_status['eof']) {
|
if ($sock_status['eof']) {
|
||||||
// The socket is valid but we are not connected
|
//The socket is valid but we are not connected
|
||||||
$this->edebug(
|
$this->edebug(
|
||||||
'SMTP NOTICE: EOF caught while checking if connected',
|
'SMTP NOTICE: EOF caught while checking if connected',
|
||||||
self::DEBUG_CLIENT
|
self::DEBUG_CLIENT
|
||||||
|
@ -653,7 +665,7 @@ class SMTP
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true; // everything looks good
|
return true; //everything looks good
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -671,7 +683,7 @@ class SMTP
|
||||||
$this->server_caps = null;
|
$this->server_caps = null;
|
||||||
$this->helo_rply = null;
|
$this->helo_rply = null;
|
||||||
if (is_resource($this->smtp_conn)) {
|
if (is_resource($this->smtp_conn)) {
|
||||||
// close the connection and cleanup
|
//Close the connection and cleanup
|
||||||
fclose($this->smtp_conn);
|
fclose($this->smtp_conn);
|
||||||
$this->smtp_conn = null; //Makes for cleaner serialization
|
$this->smtp_conn = null; //Makes for cleaner serialization
|
||||||
$this->edebug('Connection: closed', self::DEBUG_CONNECTION);
|
$this->edebug('Connection: closed', self::DEBUG_CONNECTION);
|
||||||
|
@ -706,7 +718,7 @@ class SMTP
|
||||||
* NOTE: this does not count towards line-length limit.
|
* NOTE: this does not count towards line-length limit.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Normalize line breaks before exploding
|
//Normalize line breaks before exploding
|
||||||
$lines = explode("\n", str_replace(["\r\n", "\r"], "\n", $msg_data));
|
$lines = explode("\n", str_replace(["\r\n", "\r"], "\n", $msg_data));
|
||||||
|
|
||||||
/* To distinguish between a complete RFC822 message and a plain message body, we check if the first field
|
/* To distinguish between a complete RFC822 message and a plain message body, we check if the first field
|
||||||
|
@ -752,7 +764,8 @@ class SMTP
|
||||||
|
|
||||||
//Send the lines to the server
|
//Send the lines to the server
|
||||||
foreach ($lines_out as $line_out) {
|
foreach ($lines_out as $line_out) {
|
||||||
//RFC2821 section 4.5.2
|
//Dot-stuffing as per RFC5321 section 4.5.2
|
||||||
|
//https://tools.ietf.org/html/rfc5321#section-4.5.2
|
||||||
if (!empty($line_out) && $line_out[0] === '.') {
|
if (!empty($line_out) && $line_out[0] === '.') {
|
||||||
$line_out = '.' . $line_out;
|
$line_out = '.' . $line_out;
|
||||||
}
|
}
|
||||||
|
@ -786,7 +799,16 @@ class SMTP
|
||||||
public function hello($host = '')
|
public function hello($host = '')
|
||||||
{
|
{
|
||||||
//Try extended hello first (RFC 2821)
|
//Try extended hello first (RFC 2821)
|
||||||
return $this->sendHello('EHLO', $host) or $this->sendHello('HELO', $host);
|
if ($this->sendHello('EHLO', $host)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Some servers shut down the SMTP service here (RFC 5321)
|
||||||
|
if (substr($this->helo_rply, 0, 3) == '421') {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->sendHello('HELO', $host);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -976,12 +998,12 @@ class SMTP
|
||||||
$this->client_send($commandstring . static::LE, $command);
|
$this->client_send($commandstring . static::LE, $command);
|
||||||
|
|
||||||
$this->last_reply = $this->get_lines();
|
$this->last_reply = $this->get_lines();
|
||||||
// Fetch SMTP code and possible error code explanation
|
//Fetch SMTP code and possible error code explanation
|
||||||
$matches = [];
|
$matches = [];
|
||||||
if (preg_match('/^([\d]{3})[ -](?:([\d]\\.[\d]\\.[\d]{1,2}) )?/', $this->last_reply, $matches)) {
|
if (preg_match('/^([\d]{3})[ -](?:([\d]\\.[\d]\\.[\d]{1,2}) )?/', $this->last_reply, $matches)) {
|
||||||
$code = (int) $matches[1];
|
$code = (int) $matches[1];
|
||||||
$code_ex = (count($matches) > 2 ? $matches[2] : null);
|
$code_ex = (count($matches) > 2 ? $matches[2] : null);
|
||||||
// Cut off error code from each response line
|
//Cut off error code from each response line
|
||||||
$detail = preg_replace(
|
$detail = preg_replace(
|
||||||
"/{$code}[ -]" .
|
"/{$code}[ -]" .
|
||||||
($code_ex ? str_replace('.', '\\.', $code_ex) . ' ' : '') . '/m',
|
($code_ex ? str_replace('.', '\\.', $code_ex) . ' ' : '') . '/m',
|
||||||
|
@ -989,7 +1011,7 @@ class SMTP
|
||||||
$this->last_reply
|
$this->last_reply
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
// Fall back to simple parsing if regex fails
|
//Fall back to simple parsing if regex fails
|
||||||
$code = (int) substr($this->last_reply, 0, 3);
|
$code = (int) substr($this->last_reply, 0, 3);
|
||||||
$code_ex = null;
|
$code_ex = null;
|
||||||
$detail = substr($this->last_reply, 4);
|
$detail = substr($this->last_reply, 4);
|
||||||
|
@ -1184,7 +1206,7 @@ class SMTP
|
||||||
*/
|
*/
|
||||||
protected function get_lines()
|
protected function get_lines()
|
||||||
{
|
{
|
||||||
// If the connection is bad, give up straight away
|
//If the connection is bad, give up straight away
|
||||||
if (!is_resource($this->smtp_conn)) {
|
if (!is_resource($this->smtp_conn)) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
@ -1237,13 +1259,13 @@ class SMTP
|
||||||
$str = @fgets($this->smtp_conn, self::MAX_REPLY_LENGTH);
|
$str = @fgets($this->smtp_conn, self::MAX_REPLY_LENGTH);
|
||||||
$this->edebug('SMTP INBOUND: "' . trim($str) . '"', self::DEBUG_LOWLEVEL);
|
$this->edebug('SMTP INBOUND: "' . trim($str) . '"', self::DEBUG_LOWLEVEL);
|
||||||
$data .= $str;
|
$data .= $str;
|
||||||
// If response is only 3 chars (not valid, but RFC5321 S4.2 says it must be handled),
|
//If response is only 3 chars (not valid, but RFC5321 S4.2 says it must be handled),
|
||||||
// or 4th character is a space or a line break char, we are done reading, break the loop.
|
//or 4th character is a space or a line break char, we are done reading, break the loop.
|
||||||
// String array access is a significant micro-optimisation over strlen
|
//String array access is a significant micro-optimisation over strlen
|
||||||
if (!isset($str[3]) || $str[3] === ' ' || $str[3] === "\r" || $str[3] === "\n") {
|
if (!isset($str[3]) || $str[3] === ' ' || $str[3] === "\r" || $str[3] === "\n") {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// Timed-out? Log and break
|
//Timed-out? Log and break
|
||||||
$info = stream_get_meta_data($this->smtp_conn);
|
$info = stream_get_meta_data($this->smtp_conn);
|
||||||
if ($info['timed_out']) {
|
if ($info['timed_out']) {
|
||||||
$this->edebug(
|
$this->edebug(
|
||||||
|
@ -1252,7 +1274,7 @@ class SMTP
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// Now check if reads took too long
|
//Now check if reads took too long
|
||||||
if ($endtime && time() > $endtime) {
|
if ($endtime && time() > $endtime) {
|
||||||
$this->edebug(
|
$this->edebug(
|
||||||
'SMTP -> get_lines(): timelimit reached (' .
|
'SMTP -> get_lines(): timelimit reached (' .
|
||||||
|
|
Loading…
Reference in New Issue