* Mail: allow to configure an auto-responder, if Sieve supports the vacation-seconds extension

This commit is contained in:
ralf 2023-12-07 16:34:24 +02:00
parent 04271cabc3
commit e9e96e3c39
5 changed files with 30 additions and 7 deletions

View File

@ -77,6 +77,7 @@ class Script
{
$this->extensions = [
'vacation' => $connection->hasExtension('vacation'),
'vacation-seconds' => $connection->hasExtension('vacation-seconds'),
'regex' => $connection->hasExtension('regex'),
'enotify' => $connection->hasExtension('enotify'),
'body' => $connection->hasExtension('body'),
@ -434,7 +435,7 @@ class Script
if ($this->vacation) {
$vacation = $this->vacation;
if (!$vacation['days']) $vacation['days'] = $default->vacation_days ?: '';
if ((string)$vacation['days'] === '' || $vacation['days'] < 0) $vacation['days'] = $default->vacation_days ?: 3;
if (!$vacation['text']) $vacation['text'] = $default->vacation_text ?: '';
if (!$vacation['status']) $vacation['status'] = 'on';
@ -489,7 +490,14 @@ class Script
}
if (!isset($vacation['modus']) || $vacation['modus'] !== 'store')
{
$vac_rule .= "vacation :days " . $vacation['days'];
if ($vacation['days'])
{
$vac_rule .= "vacation :days " . $vacation['days'];
}
else
{
$vac_rule .= "vacation :seconds 1";
}
$first = 1;
if (!empty($vacation['addresses'][0]))
{
@ -589,7 +597,7 @@ class Script
if ($this->extensions['regex'] && $regexused) $newscripthead .= ",\"regex\"";
if ($rejectused) $newscripthead .= ",\"reject\"";
if ($this->vacation && $vacation_active) {
$newscripthead .= ",\"vacation\"";
$newscripthead .= (string)$this->vacation['days'] === '0' ? ',"vacation-seconds"' : ',"vacation"';
}
if ($this->extensions['body']) $newscripthead .= ",\"body\"";
if ($this->extensions['date']) $newscripthead .= ",\"date\"";
@ -604,7 +612,7 @@ class Script
$closeRequired = false;
if ($this->vacation)
{
$newscripthead .= "require [\"vacation\"";
$newscripthead .= (string)$this->vacation['days'] === '0' ? ',"vacation-seconds"' : ',"vacation"';
if ($this->extensions['variables']) $newscripthead .= ',"variables"';
if ($this->extensions['regex'] && $regexused) $newscripthead .= ",\"regex\"";
if ($this->extensions['date']) $newscripthead .= ",\"date\"";

View File

@ -590,7 +590,8 @@ class mail_sieve
Framework::refresh_opener($msg, 'mail');
}
//Set default value for days new entry
if (empty($content['days']))
if ((string)$content['days'] === '' || $content['days'] < 0 ||
!$content['days'] && !in_array('VACATION-SECONDS', $icServer->getExtensions()))
{
$content['days'] = '3';
}
@ -709,6 +710,14 @@ class mail_sieve
),
'addresses' => array_combine($vacRules['aliases'],$vacRules['aliases']),
);
if (in_array('VACATION-SECONDS', $icServer->getExtensions()))
{
$sel_options['days']['0'] = lang('Always respond / auto-responder');
}
for($d=1; $d <= 31; ++$d)
{
$sel_options['days'][(string)$d] = $d === 1 ? lang('Once per day') : lang('Every %1. day', $d);
}
if (!isset($account_id))
{
$readonlys['acc_id'] = true;
@ -849,7 +858,7 @@ class mail_sieve
$this->errorStack['text'] = lang('Please supply the message to send with auto-responses').'! ';
}
if (!$_vacation['days'])
if ((string)$_vacation['days'] === '' || $_vacation['days'] < 0)
{
$this->errorStack['days'] = lang('Please select the number of days to wait between responses').'!';
}

View File

@ -50,6 +50,7 @@ allow users to create further identities mail de Anwender dürfen weitere Identi
allways a new window mail de immer in einem neuen Fenster
always mail de Immer
always allow external sources from %1 mail de Erlaube externe Bildquellen von %1
always respond / auto-responder mail de Immer antworten / Auto-Responder
always show html emails mail de HTML-E-Mails immer anzeigen
always show notifiction mail de Benachrichtigungen immer anzeigen
an error happend while trying to remove acl rights from the account %1! mail de Ein Fehler trat auf beim Versuch die Zugriffskontrollrechte vom Konto %1 zu entfernen!
@ -218,6 +219,7 @@ error: could not send message. mail de FEHLER: Die Nachricht konnte nicht versen
error: message could not be displayed. mail de FEHLER: Die Nachricht kann nicht angezeigt werden.
esync will fail without a working email configuration! mail de eSync steht Ihnen nicht zur Verfügung, weil kein gültiges Mailkonto eingestellt wurde!
event details follow mail de Details zum Termin folgen
every %1. day mail de Jeden %1. Tag
everyone mail de Alle Anwender
examine namespace to retrieve folders in others and shared mail de Den Namensraum untersuchen, um Ordner in anderen und gemeinsam genutzten Ordnern abzurufen
extended mail de Erweitert
@ -408,6 +410,7 @@ notify when new mails arrive in these folders mail de Benachrichtigung, sobald n
on mail de am
on behalf of mail de Im Namen von
on vacation mail de Abwesenheit
once per day mail de Einmal pro Tag
one address is not valid mail de Eine Adresse ist ungültig
only email mail de Nur E-Mail
only if currently in an other app mail de Nur anzeigen wenn aktuell in einer anderen Anwendung

View File

@ -50,6 +50,7 @@ allow users to create further identities mail en Allow users to create further i
allways a new window mail en Allways a new window
always mail en Always
always allow external sources from %1 mail en Always allow external sources from %1
always respond / auto-responder mail en Always respond / auto-responder
always show html emails mail en Always show HTML emails
always show notifiction mail en Always show notification
an error happend while trying to remove acl rights from the account %1! mail en An error happend while trying to remove ACL rights from the account %1!
@ -218,6 +219,7 @@ error: could not send message. mail en Error: Could not send Message.
error: message could not be displayed. mail en ERROR: Message could not be displayed.
esync will fail without a working email configuration! mail en eSync will FAIL without a working email configuration!
event details follow mail en Event Details follow
every %1. day mail en Every %1. day
everyone mail en Everyone
examine namespace to retrieve folders in others and shared mail en Examine namespace to retrieve folders in others and shared
extended mail en Extended
@ -408,6 +410,7 @@ notify when new mails arrive in these folders mail en notify when new emails arr
on mail en on
on behalf of mail en On behalf of
on vacation mail en On vacation
once per day mail en Once per day
one address is not valid mail en One address is not valid
only email mail en Only email
only if currently in an other app mail en Only if currently in an other app

View File

@ -50,7 +50,7 @@
</row>
<row>
<et2-description value="Resend after how many days?"></et2-description>
<et2-number id="days" min="1" max="31" precision="0"></et2-number>
<et2-select id="days"></et2-select>
</row>
<row>
<et2-description value="Set it as default:" disabled="@is_not_admin_user"></et2-description>