HEX
Server: LiteSpeed
System: Linux php-prod-1.spaceapp.ru 5.15.0-160-generic #170-Ubuntu SMP Wed Oct 1 10:06:56 UTC 2025 x86_64
User: xnsbb3110 (1041)
PHP: 8.1.33
Disabled: NONE
Upload Files
File: //usr/local/CyberCP/public/snappymail/snappymail/v/2.38.2/app/libraries/MailSo/Smtp/Settings.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;
	}

	#[\ReturnTypeWillChange]
	public function jsonSerialize()
	{
		return \array_merge(
			parent::jsonSerialize(),
			[
//				'@Object' => 'Object/SmtpSettings',
				'useAuth' => $this->useAuth,
				'setSender' => $this->setSender,
				'usePhpMail' => $this->usePhpMail,
				'authPlainLine' => $this->authPlainLine
//				'viewErrors' => $this->viewErrors
			]
		);
	}

}