mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
Sieve test connection
This commit is contained in:
parent
b563528be7
commit
63a286a6b6
5 changed files with 88 additions and 12 deletions
|
|
@ -3150,9 +3150,12 @@ class Actions
|
|||
$sImapErrorDesc = '';
|
||||
$bSmtpResult = false;
|
||||
$sSmtpErrorDesc = '';
|
||||
$bSieveResult = false;
|
||||
$sSieveErrorDesc = '';
|
||||
|
||||
$iImapTime = 0;
|
||||
$iSmtpTime = 0;
|
||||
$iSieveTime = 0;
|
||||
|
||||
$iConnectionTimeout = 5;
|
||||
|
||||
|
|
@ -3230,11 +3233,42 @@ class Actions
|
|||
$sSmtpErrorDesc = $oException->getMessage();
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
$oSieveClient = \MailSo\Sieve\ManageSieveClient::NewInstance()->SetLogger($this->Logger());
|
||||
$oSieveClient->SetTimeOuts($iConnectionTimeout);
|
||||
|
||||
$iTime = \microtime(true);
|
||||
$oSieveClient->Connect($oDomain->SieveHost(), $oDomain->SievePort(), $oDomain->SieveSecure(),
|
||||
!!$this->Config()->Get('ssl', 'verify_certificate', false),
|
||||
!!$this->Config()->Get('ssl', 'allow_self_signed', true)
|
||||
);
|
||||
|
||||
$iSieveTime = \microtime(true) - $iTime;
|
||||
$oSieveClient->Disconnect();
|
||||
$bSieveResult = true;
|
||||
}
|
||||
catch (\MailSo\Net\Exceptions\SocketCanNotConnectToHostException $oException)
|
||||
{
|
||||
$this->Logger()->WriteException($oException, \MailSo\Log\Enumerations\Type::ERROR);
|
||||
$sSieveErrorDesc = $oException->getSocketMessage();
|
||||
if (empty($sSieveErrorDesc))
|
||||
{
|
||||
$sSieveErrorDesc = $oException->getMessage();
|
||||
}
|
||||
}
|
||||
catch (\Exception $oException)
|
||||
{
|
||||
$this->Logger()->WriteException($oException, \MailSo\Log\Enumerations\Type::ERROR);
|
||||
$sSieveErrorDesc = $oException->getMessage();
|
||||
}
|
||||
}
|
||||
|
||||
return $this->DefaultResponse(__FUNCTION__, array(
|
||||
'Imap' => $bImapResult ? true : $sImapErrorDesc,
|
||||
'Smtp' => $bSmtpResult ? true : $sSmtpErrorDesc
|
||||
'Smtp' => $bSmtpResult ? true : $sSmtpErrorDesc,
|
||||
'Sieve' => $bSieveResult ? true : $sSieveErrorDesc
|
||||
));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -18,10 +18,15 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="span5" data-bind="css: { 'testing-done': testingDone, 'testing-error': testingImapError }">
|
||||
<div class="legend imap-header">
|
||||
<div class="span5">
|
||||
<div class="legend imap-header" data-bind="visible: !sieveSettings(), css: { 'testing-done': testingDone, 'testing-error': testingImapError }">
|
||||
<span data-placement="bottom" data-bind="tooltipForTest: testingImapErrorDesc">
|
||||
<span data-bind="text: sieveSettings() ? 'SIEVE' : 'IMAP'">IMAP</span>
|
||||
IMAP
|
||||
</span>
|
||||
</div>
|
||||
<div class="legend sieve-header" data-bind="visible: sieveSettings(), css: { 'testing-done': testingDone, 'testing-error': testingSieveError }">
|
||||
<span data-placement="bottom" data-bind="tooltipForTest: testingSieveErrorDesc">
|
||||
SIEVE
|
||||
</span>
|
||||
</div>
|
||||
<div data-bind="visible: !sieveSettings()">
|
||||
|
|
@ -144,8 +149,8 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="span5" data-bind="css: { 'testing-done': testingDone, 'testing-error': testingSmtpError }">
|
||||
<div class="legend smtp-header">
|
||||
<div class="span5">
|
||||
<div class="legend smtp-header" data-bind="css: { 'testing-done': testingDone, 'testing-error': testingSmtpError }">
|
||||
<span data-placement="bottom" data-bind="tooltipForTest: testingSmtpErrorDesc">
|
||||
SMTP
|
||||
</span>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue