diff --git a/data/conf/rspamd/local.d/multimap.conf b/data/conf/rspamd/local.d/multimap.conf index 50bced3e..6237f007 100644 --- a/data/conf/rspamd/local.d/multimap.conf +++ b/data/conf/rspamd/local.d/multimap.conf @@ -6,10 +6,16 @@ RCPT_MAILCOW_DOMAIN { RCPT_WANTS_SUBJECT_TAG { type = "rcpt"; - filter = "email:addr" + filter = "email:addr"; map = "redis://RCPT_WANTS_SUBJECT_TAG"; } +RCPT_WANTS_SUBFOLDER_TAG { + type = "rcpt"; + filter = "email:addr"; + map = "redis://RCPT_WANTS_SUBFOLDER_TAG"; +} + WHITELISTED_FWD_HOST { type = "ip"; map = "redis://WHITELISTED_FWD_HOST"; diff --git a/data/conf/rspamd/lua/rspamd.local.lua b/data/conf/rspamd/lua/rspamd.local.lua index 4e6dc27f..11617853 100644 --- a/data/conf/rspamd/lua/rspamd.local.lua +++ b/data/conf/rspamd/lua/rspamd.local.lua @@ -30,6 +30,7 @@ rspamd_config:register_symbol({ end local wants_subject_tag = task:get_symbol("RCPT_WANTS_SUBJECT_TAG") + local wants_subfolder_tag = task:get_symbol("RCPT_WANTS_SUBFOLDER_TAG") if wants_subject_tag then rspamd_logger.infox("user wants subject modified for tagged mail") @@ -39,7 +40,7 @@ rspamd_config:register_symbol({ remove_headers = {['Subject'] = 1}, add_headers = {['Subject'] = new_sbj} }) - else + elseif wants_subfolder_tag then rspamd_logger.infox("Add X-Moo-Tag header") task:set_milter_reply({ add_headers = {['X-Moo-Tag'] = 'YES'} diff --git a/data/web/inc/functions.mailbox.inc.php b/data/web/inc/functions.mailbox.inc.php index 21f05b0f..db9d10a5 100644 --- a/data/web/inc/functions.mailbox.inc.php +++ b/data/web/inc/functions.mailbox.inc.php @@ -1308,6 +1308,20 @@ function mailbox($_action, $_type, $_data = null, $attr = null) { if (isset($_data['tagged_mail_handler']) && $_data['tagged_mail_handler'] == "subject") { try { $redis->hSet('RCPT_WANTS_SUBJECT_TAG', $username, 1); + $redis->hDel('RCPT_WANTS_SUBFOLDER_TAG', $username); + } + catch (RedisException $e) { + $_SESSION['return'] = array( + 'type' => 'danger', + 'msg' => 'Redis: '.$e + ); + return false; + } + } + else if (isset($_data['tagged_mail_handler']) && $_data['tagged_mail_handler'] == "subfolder") { + try { + $redis->hSet('RCPT_WANTS_SUBFOLDER_TAG', $username, 1); + $redis->hDel('RCPT_WANTS_SUBJECT_TAG', $username); } catch (RedisException $e) { $_SESSION['return'] = array( @@ -1320,6 +1334,7 @@ function mailbox($_action, $_type, $_data = null, $attr = null) { else { try { $redis->hDel('RCPT_WANTS_SUBJECT_TAG', $username); + $redis->hDel('RCPT_WANTS_SUBFOLDER_TAG', $username); } catch (RedisException $e) { $_SESSION['return'] = array( @@ -2632,9 +2647,12 @@ function mailbox($_action, $_type, $_data = null, $attr = null) { if ($redis->hGet('RCPT_WANTS_SUBJECT_TAG', $_data)) { return "subject"; } - else { + elseif ($redis->hGet('RCPT_WANTS_SUBFOLDER_TAG', $_data)) { return "subfolder"; } + else { + return "none"; + } } catch (RedisException $e) { $_SESSION['return'] = array( @@ -3729,4 +3747,4 @@ function mailbox($_action, $_type, $_data = null, $attr = null) { } break; } -} \ No newline at end of file +} diff --git a/data/web/lang/lang.de.php b/data/web/lang/lang.de.php index c4cdf514..940a8588 100644 --- a/data/web/lang/lang.de.php +++ b/data/web/lang/lang.de.php @@ -176,6 +176,7 @@ $lang['user']['misc_delete_profile'] = 'Sonstige Kontoeinstellungen'; $lang['user']['tag_handling'] = 'Umgang mit getaggten E-Mails steuern'; $lang['user']['tag_in_subfolder'] = 'In Unterordner'; $lang['user']['tag_in_subject'] = 'In Betreff'; +$lang['user']['tag_in_none'] = 'Nichts tun'; $lang['user']['tag_help_explain'] = 'Als Unterordner: Es wird ein Ordner mit dem Namen des Tags unterhalb der Inbox erstellt ("INBOX/Facebook").
In Betreff: Der Name des Tags wird dem Betreff angefügt, etwa "[Facebook] Meine Neuigkeiten".'; $lang['user']['tag_help_example'] = 'Beispiel für eine getaggte E-Mail-Adresse: ich+Facebook@example.org'; diff --git a/data/web/lang/lang.en.php b/data/web/lang/lang.en.php index 4f93f113..3881d731 100644 --- a/data/web/lang/lang.en.php +++ b/data/web/lang/lang.en.php @@ -175,6 +175,7 @@ $lang['user']['misc_delete_profile'] = 'Other profile settings'; $lang['user']['tag_handling'] = 'Set handling for tagged mail'; $lang['user']['tag_in_subfolder'] = 'In subfolder'; $lang['user']['tag_in_subject'] = 'In subject'; +$lang['user']['tag_in_none'] = 'Do nothing'; $lang['user']['tag_help_explain'] = 'In subfolder: a new subfolder named after the tag will be created below INBOX ("INBOX/Facebook").
In subject: the tags name will be prepended to the mails subject, example: "[Facebook] My News".'; $lang['user']['tag_help_example'] = 'Example for a tagged email address: me+Facebook@example.org'; diff --git a/data/web/lang/lang.es.php b/data/web/lang/lang.es.php index cb268a69..3cc93bdb 100644 --- a/data/web/lang/lang.es.php +++ b/data/web/lang/lang.es.php @@ -144,6 +144,7 @@ $lang['user']['misc_delete_profile'] = 'Otras configuraciones de usuario'; $lang['user']['tag_handling'] = 'Establecer manejo para el correo etiquetado'; $lang['user']['tag_in_subfolder'] = 'En subcarpeta'; $lang['user']['tag_in_subject'] = 'En asunto'; +$lang['user']['tag_in_none'] = 'Hacer nada'; $lang['user']['tag_help_explain'] = 'En subcarpeta: una nueva subcarpeta llamada como la etiqueta será creada debajo de INBOX ("INBOX/Facebook").
En asunto: los nombres de las etiquetas serán añadidos al asunto de los correos, ejemplo: "[Facebook] Mis Noticias".'; $lang['user']['tag_help_example'] = 'Ejemplo de una dirección email etiquetada: mi+Facebook@ejemplo.org'; diff --git a/data/web/lang/lang.fr.php b/data/web/lang/lang.fr.php index e89d6e55..afa04f3b 100644 --- a/data/web/lang/lang.fr.php +++ b/data/web/lang/lang.fr.php @@ -167,6 +167,7 @@ $lang['user']['misc_delete_profile'] = "Autre paramètres de profil"; $lang['user']['tag_handling'] = "Définir la gestion des courriel étiquetés"; $lang['user']['tag_in_subfolder'] = "Dans un sous-dossier"; $lang['user']['tag_in_subject'] = "Dans l'objet"; +$lang['user']['tag_in_none'] = "Ne fais rien"; $lang['user']['tag_help_explain'] = "Dans un sous-dossier : a nouveau sous-dossier portant le nom de l'étiquette sera crée sous INBOX (\"INBOX/Facebook\").
Dans l'objet : le nom de l'étiquette sera accolé à l'objet du courriel. Par exemple : \"[Facebook] Mes Nouvelles\"."; $lang['user']['tag_help_example'] = "Exemple pour une adresse de courriel étiquetée : moi+Facebook@exemple.org"; $lang['user']['eas_reset'] = "Réinitialiser le cache de l'appareil ActiveSync"; diff --git a/data/web/lang/lang.it.php b/data/web/lang/lang.it.php index 5a91e1ed..d9b03e8a 100644 --- a/data/web/lang/lang.it.php +++ b/data/web/lang/lang.it.php @@ -167,6 +167,7 @@ $lang['user']['misc_delete_profile'] = 'Impostazioni di altri profili'; $lang['user']['tag_handling'] = 'Imposta le gestione della mail evidenziate'; $lang['user']['tag_in_subfolder'] = 'Nella sotto cartella'; $lang['user']['tag_in_subject'] = 'Nell\'oggetto'; +$lang['user']['tag_in_none'] = "Fare niente"; $lang['user']['tag_help_explain'] = 'In sotto cartelle: Una nuova cartella dal nome del tag verrà creata sotto INBOX ("INBOX/Facebook").
Nell\'oggetto: Il nome del tag verrà aggiunto all\'inizio dell\'oggetto mail, esempio: "[Facebook] Meine Neuigkeiten".'; $lang['user']['tag_help_example'] = 'Esempio di mail con tag: ich+Facebook@example.org'; diff --git a/data/web/lang/lang.nl.php b/data/web/lang/lang.nl.php index 88a936e1..415d271f 100644 --- a/data/web/lang/lang.nl.php +++ b/data/web/lang/lang.nl.php @@ -140,6 +140,7 @@ $lang['user']['misc_delete_profile'] = 'Andere profielinstellingen'; $lang['user']['tag_handling'] = 'Omgaan met e-mail tags'; $lang['user']['tag_in_subfolder'] = 'In onderliggende map'; $lang['user']['tag_in_subject'] = 'In onderwerp'; +$lang['user']['tag_in_none'] = 'Niets doen'; $lang['user']['tag_help_explain'] = 'In onderliggende map: maakt onder INBOX een nieuwe map aan met de naam van de tag (bijv.: "INBOX/Facebook").
In onderwerp: de tag wordt vóór het oorspronkelijke e-mail onderwerp geplaatst (bijv.: "[Facebook] Mijn nieuws").'; $lang['user']['tag_help_example'] = 'Voorbeeld van een e-mailadres met tag: ik+Facebook@voorbeeld.org'; diff --git a/data/web/lang/lang.pl.php b/data/web/lang/lang.pl.php index 423e0843..497fe42b 100644 --- a/data/web/lang/lang.pl.php +++ b/data/web/lang/lang.pl.php @@ -169,6 +169,7 @@ $lang['user']['misc_delete_profile'] = 'Ustawienia innego profilu'; $lang['user']['tag_handling'] = 'Ustaw obsługę znaczników pocztowych'; $lang['user']['tag_in_subfolder'] = 'W podfolderze'; $lang['user']['tag_in_subject'] = 'W temacie'; +$lang['user']['tag_in_none'] = 'Nic nie robić'; $lang['user']['tag_help_explain'] = 'W podfolderze: tworzy nowy podfolder z nazwą taką jak etykieta, który zostanie umieszczony pod Skrzynką odbiorczą ("Skrzynka odbiorcza/Facebook").
W temacie: nazwy etykiet zostaną dodane na początku tematów wiadomości, np.: "[Facebook] Moje wiadomości".'; $lang['user']['tag_help_example'] = 'Przykład adresu email z etykietą: ja+Facebook@example.org'; diff --git a/data/web/lang/lang.ru.php b/data/web/lang/lang.ru.php index 3eaec801..647fcb8b 100644 --- a/data/web/lang/lang.ru.php +++ b/data/web/lang/lang.ru.php @@ -167,6 +167,7 @@ $lang['user']['misc_delete_profile'] = 'Другие настройки проф $lang['user']['tag_handling'] = 'Set handling for tagged mail'; $lang['user']['tag_in_subfolder'] = 'В подпапку'; $lang['user']['tag_in_subject'] = 'В теме'; +$lang['user']['tag_in_none'] = 'Ничего не делать'; $lang['user']['tag_help_explain'] = 'In subfolder: a new subfolder named after the tag will be created below INBOX ("INBOX/Facebook").
In subject: the tags name will be prepended to the mails subject, example: "[Facebook] Meine Neuigkeiten".'; $lang['user']['tag_help_example'] = 'Example for a tagged email address: ich+Facebook@example.org'; diff --git a/data/web/user.php b/data/web/user.php index 3e170cfe..5ccd0f8f 100644 --- a/data/web/user.php +++ b/data/web/user.php @@ -178,6 +178,13 @@ elseif (isset($_SESSION['mailcow_cc_role']) && $_SESSION['mailcow_cc_role'] == ' data-api-url='edit/delimiter_action' data-api-attr='{"tagged_mail_handler":"subject"}'> + +