diff --git a/data/web/edit.php b/data/web/edit.php index 9a1e5a5c1..7ce4d0c6a 100644 --- a/data/web/edit.php +++ b/data/web/edit.php @@ -125,6 +125,7 @@ if (isset($_SESSION['mailcow_cc_role'])) { 'mailbox' => $mailbox, 'rl' => $rl, 'pushover_data' => $pushover_data, + 'get_tagging_options' => mailbox('get', 'delimiter_action', $mailbox), 'quarantine_notification' => $quarantine_notification, 'quarantine_category' => $quarantine_category, 'get_tls_policy' => $get_tls_policy, diff --git a/data/web/inc/functions.mailbox.inc.php b/data/web/inc/functions.mailbox.inc.php index d5daeddcd..6ea4f5717 100644 --- a/data/web/inc/functions.mailbox.inc.php +++ b/data/web/inc/functions.mailbox.inc.php @@ -1223,6 +1223,14 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) { $stmt->execute(array( ':username' => $username )); + // save delimiter_action + if (isset($_data['tagged_mail_handler'])) { + mailbox('edit', 'delimiter_action', array( + 'username' => $username, + 'tagged_mail_handler' => $_data['tagged_mail_handler'] + )); + } + // save tags foreach($tags as $index => $tag){ if (empty($tag)) continue; @@ -1613,6 +1621,7 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) { $attr = array(); $attr["quota"] = isset($_data['quota']) ? intval($_data['quota']) * 1048576 : 0; $attr['tags'] = (isset($_data['tags'])) ? $_data['tags'] : array(); + $attr["tagged_mail_handler"] = (!empty($_data['tagged_mail_handler'])) ? $_data['tagged_mail_handler'] : strval($MAILBOX_DEFAULT_ATTRIBUTES['tagged_mail_handler']); $attr["quarantine_notification"] = (!empty($_data['quarantine_notification'])) ? $_data['quarantine_notification'] : strval($MAILBOX_DEFAULT_ATTRIBUTES['quarantine_notification']); $attr["quarantine_category"] = (!empty($_data['quarantine_category'])) ? $_data['quarantine_category'] : strval($MAILBOX_DEFAULT_ATTRIBUTES['quarantine_category']); $attr["rl_frame"] = (!empty($_data['rl_frame'])) ? $_data['rl_frame'] : "s"; @@ -3259,6 +3268,13 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) { ); return false; } + // save delimiter_action + if (isset($_data['tagged_mail_handler'])) { + mailbox('edit', 'delimiter_action', array( + 'username' => $username, + 'tagged_mail_handler' => $_data['tagged_mail_handler'] + )); + } // save tags foreach($tags as $index => $tag){ if (empty($tag)) continue; @@ -3604,6 +3620,7 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) { $attr = array(); $attr["quota"] = isset($_data['quota']) ? intval($_data['quota']) * 1048576 : 0; $attr['tags'] = (isset($_data['tags'])) ? $_data['tags'] : $is_now['tags']; + $attr["tagged_mail_handler"] = (!empty($_data['tagged_mail_handler'])) ? $_data['tagged_mail_handler'] : $is_now['tagged_mail_handler']; $attr["quarantine_notification"] = (!empty($_data['quarantine_notification'])) ? $_data['quarantine_notification'] : $is_now['quarantine_notification']; $attr["quarantine_category"] = (!empty($_data['quarantine_category'])) ? $_data['quarantine_category'] : $is_now['quarantine_category']; $attr["rl_frame"] = (!empty($_data['rl_frame'])) ? $_data['rl_frame'] : $is_now['rl_frame']; diff --git a/data/web/inc/vars.inc.php b/data/web/inc/vars.inc.php index 671e20334..568105308 100644 --- a/data/web/inc/vars.inc.php +++ b/data/web/inc/vars.inc.php @@ -186,6 +186,12 @@ $MAILBOX_DEFAULT_ATTRIBUTES['force_pw_update'] = false; // Enable SOGo access - Users will be redirected to SOGo after login (set to false to disable redirect by default) $MAILBOX_DEFAULT_ATTRIBUTES['sogo_access'] = true; +// How to handle tagged emails +// none - No special handling +// subfolder - Create subfolder under INBOX (e.g. "INBOX/Facebook") +// subject - Add tag to subject (e.g. "[Facebook] Subject") +$MAILBOX_DEFAULT_ATTRIBUTES['tagged_mail_handler'] = "none"; + // Send notification when quarantine is not empty (never, hourly, daily, weekly) $MAILBOX_DEFAULT_ATTRIBUTES['quarantine_notification'] = 'hourly'; @@ -257,57 +263,57 @@ $RSPAMD_MAPS = array( $IMAPSYNC_OPTIONS = array( 'whitelist' => array( - 'abort', - 'authmd51', - 'authmd52', + 'abort', + 'authmd51', + 'authmd52', 'authmech1', 'authmech2', - 'authuser1', - 'authuser2', - 'debug', - 'debugcontent', - 'debugcrossduplicates', - 'debugflags', - 'debugfolders', - 'debugimap', - 'debugimap1', - 'debugimap2', - 'debugmemory', - 'debugssl', + 'authuser1', + 'authuser2', + 'debug', + 'debugcontent', + 'debugcrossduplicates', + 'debugflags', + 'debugfolders', + 'debugimap', + 'debugimap1', + 'debugimap2', + 'debugmemory', + 'debugssl', 'delete1emptyfolders', - 'delete2folders', - 'disarmreadreceipts', + 'delete2folders', + 'disarmreadreceipts', 'domain1', 'domain2', - 'domino1', - 'domino2', + 'domino1', + 'domino2', 'dry', 'errorsmax', - 'exchange1', - 'exchange2', + 'exchange1', + 'exchange2', 'exitwhenover', 'expunge1', - 'f1f2', - 'filterbuggyflags', + 'f1f2', + 'filterbuggyflags', 'folder', 'folderfirst', 'folderlast', 'folderrec', - 'gmail1', - 'gmail2', - 'idatefromheader', + 'gmail1', + 'gmail2', + 'idatefromheader', 'include', 'inet4', 'inet6', - 'justconnect', - 'justfolders', - 'justfoldersizes', - 'justlogin', - 'keepalive1', - 'keepalive2', + 'justconnect', + 'justfolders', + 'justfoldersizes', + 'justlogin', + 'keepalive1', + 'keepalive2', 'log', 'logdir', - 'logfile', + 'logfile', 'maxbytesafter', 'maxlinelength', 'maxmessagespersecond', @@ -315,62 +321,62 @@ $IMAPSYNC_OPTIONS = array( 'maxsleep', 'minage', 'minsize', - 'noabletosearch', - 'noabletosearch1', - 'noabletosearch2', - 'noexpunge1', - 'noexpunge2', + 'noabletosearch', + 'noabletosearch1', + 'noabletosearch2', + 'noexpunge1', + 'noexpunge2', 'nofoldersizesatend', - 'noid', - 'nolog', - 'nomixfolders', - 'noresyncflags', - 'nossl1', - 'nossl2', - 'nosyncacls', - 'notls1', - 'notls2', - 'nouidexpunge2', - 'nousecache', + 'noid', + 'nolog', + 'nomixfolders', + 'noresyncflags', + 'nossl1', + 'nossl2', + 'nosyncacls', + 'notls1', + 'notls2', + 'nouidexpunge2', + 'nousecache', 'oauthaccesstoken1', 'oauthaccesstoken2', 'oauthdirect1', 'oauthdirect2', - 'office1', - 'office2', - 'pidfile', - 'pidfilelocking', + 'office1', + 'office2', + 'pidfile', + 'pidfilelocking', 'prefix1', 'prefix2', - 'proxyauth1', - 'proxyauth2', - 'resyncflags', - 'resynclabels', - 'search', + 'proxyauth1', + 'proxyauth2', + 'resyncflags', + 'resynclabels', + 'search', 'search1', - 'search2', + 'search2', 'sep1', 'sep2', 'showpasswords', 'skipemptyfolders', - 'ssl2', + 'ssl2', 'sslargs1', - 'sslargs2', + 'sslargs2', 'subfolder1', - 'subscribe', + 'subscribe', 'subscribed', 'syncacls', 'syncduplicates', 'syncinternaldates', - 'synclabels', - 'tests', - 'testslive', - 'testslive6', - 'tls2', - 'truncmess', - 'usecache', - 'useheader', - 'useuid' + 'synclabels', + 'tests', + 'testslive', + 'testslive6', + 'tls2', + 'truncmess', + 'usecache', + 'useheader', + 'useuid' ), 'blacklist' => array( 'skipmess', diff --git a/data/web/js/site/mailbox.js b/data/web/js/site/mailbox.js index 28e6fd284..135ec764a 100644 --- a/data/web/js/site/mailbox.js +++ b/data/web/js/site/mailbox.js @@ -269,6 +269,24 @@ $(document).ready(function() { function setMailboxTemplateData(template){ $("#addInputQuota").val(template.quota / 1048576); + if (template.tagged_mail_handler === "subfolder"){ + $('#tagged_mail_handler_subfolder').prop('checked', true); + $('#tagged_mail_handler_subject').prop('checked', false); + $('#tagged_mail_handler_none').prop('checked', false); + } else if(template.tagged_mail_handler === "subject"){ + $('#tagged_mail_handler_subfolder').prop('checked', false); + $('#tagged_mail_handler_subject').prop('checked', true); + $('#tagged_mail_handler_none').prop('checked', false); + } else if(template.tagged_mail_handler === "none"){ + $('#tagged_mail_handler_subfolder').prop('checked', false); + $('#tagged_mail_handler_subject').prop('checked', false); + $('#tagged_mail_handler_none').prop('checked', true); + } else { + $('#tagged_mail_handler_subfolder').prop('checked', false); + $('#tagged_mail_handler_subject').prop('checked', false); + $('#tagged_mail_handler_none').prop('checked', true); + } + if (template.quarantine_notification === "never"){ $('#quarantine_notification_never').prop('checked', true); $('#quarantine_notification_hourly').prop('checked', false); diff --git a/data/web/templates/edit/mailbox-templates.twig b/data/web/templates/edit/mailbox-templates.twig index 6d150b263..65a83cd2a 100644 --- a/data/web/templates/edit/mailbox-templates.twig +++ b/data/web/templates/edit/mailbox-templates.twig @@ -36,6 +36,23 @@ 0 = ∞ +
{{ lang.user.tag_help_explain|raw }}
+{{ lang.user.tag_help_example|raw }}
+{{ lang.user.tag_help_explain|raw }}
+{{ lang.user.tag_help_example|raw }}
{{ lang.user.tag_help_explain|raw }}
+{{ lang.user.tag_help_example|raw }}
+{{ lang.user.tag_help_explain|raw }}
+{{ lang.user.tag_help_example|raw }}
+