Extend Inbox Rule Functionality
Author: wrdhubCreated Jul 17, 2026Updated Sep 17, 2026
Labelstopic: inbox rule
Acceptance Criteria:
- Inbox Rules have a user-defined name
- Inbox Rules can have multiple Conditions and Results
- All conditions must be met for the Inbox Rule to apply
- The first matching Inbox Rule that is found is applied
- All Results for the matching Rule are applied
- There is a new "Any recipient field" Condition that checks if the value is in the To, CC, or BCC field.
- There is a new "Has Attachment" Condition to the Inbox Rule Dialog
- There is a new "Does not have Attachment" Condition to the Inbox Rule Dialog
- A new "Label" Result can be added on an Inbox Rule
- A new "Mark Read" Result can be added to an Inbox Rule
- Only one Move Result can be added to an Inbox Rule
- There is an "Add Inbox Rule" action available in the "More actions" of the mail toolbar and header
- There is a new, separate section in the settings for Inbox Rules
- Individual Inbox Rules can be disabled from the Inbox Rule list
- There is a user migration that moves the old rules to the new rule type, but does not change functionality
Test Notes:
Settings Section
- There is a section in settings called "Inbox Rules"
- There is not an area in Settings > Email for Inbox Rules
Inbox Rule List (New)
- The list shows the name of the inbox rule
- Edit and delete work as expected
- Reordering from the "more actions" still works
- Can reorder inbox rules using drag and drop
- Test on Desktop
- Test on Web
- Test on Android
- Test on iOS
- Enabling & disabling inbox rules updates the UI state correctly and persists while reordering
- On desktop and web, the "Inbox rule Management" Title shows when the list is scrolled
- On mobile apps, the "Inbox rule Management" Title scrolls away with the list
Inbox Rule List (Legacy)
- The same table as was previously in Settings > Email > Inbox Rules is now in the Inbox Rule Sections Setting
- Edit and delete work as expected
- Reordering from the "more actions" still works
Inbox Rule Dialog
- Cannot save an inbox rule with an empty name
- When an existing inbox rule is edited, the name field is filled in correctly
- Editing the name field is saved correctly
- When "Has attachment" or "Has no attachment" is selected, they do not show as selectable conditions in another dropdown
- When "Has attachment" or "Has no attachment" is selected, they do show as a selectable condition in that dropdown
Multiple conditions
- Create and edit a new inbox rule
- Type a domain (e.g. "tutanota.com") as a "To recipient" condition for the first field
- Verify you get an option to add a rule
- Add a new rule (Subject contains "blah") and verify that you get an option to add a rule once this is valid
- Add a third rule ("tutao.de") as a From address condition.
- Save the rule and re-edit the rule
- Delete the second rule, save the rule, and re-edit the rule, ensuring that the third rule is now the second rule
- Verify there is an add button below the now-second rule.
- Make the second rule invalid (make it empty, for example) and verify that the add button goes away.
- Verify that the "Edit inbox rule" option, when clicking on a sender's email address, still works as intended (it finds an existing inbox rule with the sender matching that email as the condition even if there are other conditions)
Multiple results
- Create and edit a new inbox rule
- Add a bunch of results
- Verify that, once every result type is added (and all results are valid), you can no longer add results, and you also cannot change a result type to any other type (only the current type is selectable)
- Remove a result in the middle, verifying that an add result button is now present
- Verify that all results can now be changed to the result that was just removed
Creating Inbox Rules from Mail View
Test with both Legacy and Expanded Inbox Rules:
- In the mail header, clicking on the From or To email address contains the option to "Add Inbox Rule", clicking on this opens the correct Inbox Rule Dialog with the address filled in.
- If there is an existing inbox rule with that email address, the above option is "Edit Inbox Rule" and clicking on it opens the correct inbox rule dialog with the already existing inbox rule. Test with only Expanded Inbox Rules:
- In the Email Toolbar, under "more actions" there is a "Add Inbox Rule" option. This opens a Inbox Rule dialog with the address of the sender and the subject of the email pre-filled in.
Matching Inbox Rules
- When inbox rule condition matches a mail, inbox rule results are applied (test both legacy and expanded inbox rules)
- FROM_EQUALS
- FROM_EQUALS using regex
- RECIPIENT_TO_EQUALS
- RECIPIENT_TO_EQUALS using regex
- RECIPIENT_CC_EQUALS
- RECIPIENT_CC_EQUALS using regex
- RECIPIENT_BCC_EQUALS
- RECIPIENT_BCC_EQUALS using regex
- RECIPIENT_ANY_EQUALS (only for expanded inbox rules)
- RECIPIENT_ANY_EQUALS using regex (only for expanded inbox rules)
- SUBJECT_CONTAINS
- SUBJECT_CONTAINS using regex
- MAIL_HEADER_CONTAINS
- MAIL_HEADER_CONTAINS using regex
- HAS_ATTACHMENT (only for expanded inbox rules)
- HAS_NO_ATTACHMENT (only for expanded inbox rules)
- When expanded inbox rule has multiple conditions and all of them match, the inbox rule results are applied
- When expanded inbox rule has multiple conditions but only some of them match, the inbox rule results are NOT applied
- When expanded inbox rule is marked disabled, the inbox rule results are NOT applied
Migration
- After migrating a user, the same number of Inbox Rules are there with the same condition and mail movement as before
- The name of the migrated inbox rule is [Condition] -> [Target folder], with the values filled in from the given rule
- On the login that migrates the inbox rules (first login after the server migration), if any emails were received that would be moved by an inbox rule are moved appropriately
Incoming mail processing
Incoming mails are processed correctly (test both legacy and expanded inbox rules)
- For a mail received from a trusted sender (self, contact, Tuta team)
- Client side spam classification is skipped: check the logs for the following message:
skipped spam classification for new mail [MAIL_ID]. reason: 2 … - When there's a matching inbox rule with a move result, the rule results are applied and a post request is made to
ProcessInboxServicewith:-
targetMoveFolder(attributeId1761) set to inbox rule move result -
classifierType(attributeId1762) set toCUSTOMER_INBOX_RULES(21)
-
- When there's a matching inbox rule without a move result, the rule results are applied and a post request is made to
ProcessInboxServicewith:-
targetMoveFolder(attributeId1761) set to Inbox folder -
classifierType(attributeId1762) set tonull
-
- When there's no matching inbox rule, a post request is made to
ProcessInboxServicewith:-
targetMoveFolder(attributeId1761) set to Inbox folder -
classifierType(attributeId1762) set tonull
-
- Client side spam classification is skipped: check the logs for the following message:
- For a mail with
phishingStatusset toMailPhishingStatus.SUSPICIOUS- Report a received mail as phishing and make sure it's confirmed
- Receive an identical mail so it's marked suspicious by the server
- Client side spam classification is skipped: check the logs for the following message:
skipped spam classification for new mail [MAIL_ID]. reason: 1 … - Inbox rules are not applied (even if matching rule exists and has an exclude from spam result), and a post request is made to
ProcessInboxServicewith:-
targetMoveFolder(attributeId1761) set to Spam folder -
classifierType(attributeId1762) set tonull
-
- For a mail matching a spam rule that marks the mail as spam
- Client side spam classification is skipped: check the logs for the following message:
skipped spam classification for new mail [MAIL_ID]. reason: 3 … - Inbox rules are not applied (even if matching rule exists and has an exclude from spam result), and a post request is made to
ProcessInboxServicewith:-
targetMoveFolder(attributeId1761) set to Spam folder -
classifierType(attributeId1762) set tonull
-
- Client side spam classification is skipped: check the logs for the following message:
- For a mail matching a spam rule that marks the mail as ham
- Client side spam classification is skipped: check the logs for the following message:
skipped spam classification for new mail [MAIL_ID]. reason: 3 … - When there's a matching inbox rule with a move result, the rule results are applied and a post request is made to
ProcessInboxServicewith:-
targetMoveFolder(attributeId1761) set to inbox rule move result -
classifierType(attributeId1762) set toCUSTOMER_INBOX_RULES(21)
-
- When there's a matching inbox rule without a move result, the rule results are applied and a post request is made to
ProcessInboxServicewith:-
targetMoveFolder(attributeId1761) set to Inbox folder -
classifierType(attributeId1762) set tonull
-
- Client side spam classification is skipped: check the logs for the following message:
- For a mail not classified by
SERVER_CLASSIFIERS_TO_TRUST, that's not suspicious, and not from a trusted sender- Receive a non suspicious mail that is not part of an existing conversation where the sender is not a trusted one
- Client side spam classification is NOT skipped: check
skipped spam classification …message is not logged - When the mail lands in Inbox folder after classification and a matching inbox rule exists
- Inbox rule results are applied, and a post request is made to
ProcessInboxServicewith:- When inbox rule has a move result:
-
targetMoveFolder(attributeId1761) set to inbox rule move result -
classifierType(attributeId1762) set toCUSTOMER_INBOX_RULES(21)
-
- When inbox rule has no move result:
-
targetMoveFolder(attributeId1761) set to Inbox folder -
classifierType(attributeId1762) set toCLIENT_CLASSIFICATION(20)
-
- When inbox rule has a move result:
- Inbox rule results are applied, and a post request is made to
- When no matching inbox rule exists, a post request is made to
ProcessInboxServicewith:-
targetMoveFolder(attributeId1761) set to client spam classification move target (Inbox or Spam) -
classifierType(attributeId1762) set toCLIENT_CLASSIFICATION(20)
-
- When the mail lands in Spam folder after classification and a matching inbox rule exists (this might be tricky to test, so feel free to fudge the client classification result using dev-tools)
- When inbox rule has an
exclude from spamand amoveresult, rule results are applied and a post request is made toProcessInboxServicewith:-
targetMoveFolder(attributeId1761) set to inbox rule move result -
classifierType(attributeId1762) set toCUSTOMER_INBOX_RULES(21)
-
- When inbox rule has an
exclude from spamresult but nomoveresult, rule results are applied and a post request is made toProcessInboxServicewith:-
targetMoveFolder(attributeId1761) set to Inbox folder -
classifierType(attributeId1762) set toCUSTOMER_INBOX_RULES(21)
-
- When inbox rule has no
exclude from spamresult, but has a move result that moves to Spam, the rule results are applied and a post request is made toProcessInboxServicewith:-
targetMoveFolder(attributeId1761) set to Spam folder -
classifierType(attributeId1762) set toCLIENT_CLASSIFICATION(20)
-
- When inbox rule has no
exclude from spamresult, and has a move result that does not move to Spam, the rule results are NOT applied and a post request is made toProcessInboxServicewith:-
targetMoveFolder(attributeId1761) set to Spam folder -
classifierType(attributeId1762) set toCLIENT_CLASSIFICATION(20)
-
- When inbox rule has no
exclude from spamresult and no move result, the rule results are NOT applied and a post request is made toProcessInboxServicewith:-
targetMoveFolder(attributeId1761) set to Spam folder -
classifierType(attributeId1762) set toCLIENT_CLASSIFICATION(20)
-
- When inbox rule has an
- When incoming mail is processed, post request to
ProcessInboxServiceis only made from leader client (leader client is normally the client with the highest version number that connected first)- Have 2 clients open and logged in to the same user
- Receive a new mail
- Check post request to
ProcessInboxServicewas made by leader client - Check no post request to
ProcessInboxServicewas made by non-leader client
Source: tutao/tutanota