mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-11-03 19:08:50 +03:00
67 lines
1.5 KiB
PHP
67 lines
1.5 KiB
PHP
<?php
|
|
|
|
/*
|
|
* This file is part of MailSo.
|
|
*
|
|
* (c) 2022 DJMaze
|
|
*
|
|
* For the full copyright and license information, please view the LICENSE
|
|
* file that was distributed with this source code.
|
|
*/
|
|
|
|
namespace MailSo\Smtp;
|
|
|
|
/**
|
|
* @category MailSo
|
|
* @package Net
|
|
*/
|
|
class Settings extends \MailSo\Net\ConnectSettings
|
|
{
|
|
public int
|
|
$port = 25,
|
|
$timeout = 60;
|
|
|
|
public bool
|
|
$setSender = false,
|
|
$usePhpMail = false,
|
|
// https://github.com/the-djmaze/snappymail/issues/1038
|
|
$authPlainLine = false,
|
|
$viewErrors = false;
|
|
|
|
public string $Ehlo;
|
|
|
|
public function __construct()
|
|
{
|
|
parent::__construct();
|
|
$oConfig = \RainLoop\Api::Config();
|
|
$this->viewErrors = !!$oConfig->Get('labs', 'smtp_show_server_errors', false);
|
|
}
|
|
|
|
public static function fromArray(array $aSettings): self
|
|
{
|
|
$object = parent::fromArray($aSettings);
|
|
$object->useAuth = !empty($aSettings['useAuth']);
|
|
$object->setSender = !empty($aSettings['setSender']);
|
|
$object->usePhpMail = !empty($aSettings['usePhpMail']);
|
|
$object->authPlainLine = !empty($aSettings['authPlainLine']);
|
|
// $object->viewErrors = !empty($aSettings['viewErrors']);
|
|
return $object;
|
|
}
|
|
|
|
// public function jsonSerialize(): array
|
|
public function jsonSerialize(): mixed
|
|
{
|
|
return \array_merge(
|
|
parent::jsonSerialize(),
|
|
[
|
|
// '@Object' => 'Object/SmtpSettings',
|
|
'useAuth' => $this->useAuth,
|
|
'setSender' => $this->setSender,
|
|
'usePhpMail' => $this->usePhpMail,
|
|
'authPlainLine' => $this->authPlainLine
|
|
// 'viewErrors' => $this->viewErrors
|
|
]
|
|
);
|
|
}
|
|
|
|
}
|