Space Rules
Space rules are the equivalent to filter rules in email programs like Outlook or GMail. Space Rules give you fine control over where (which Space and parent page) and how (page or blog post) emails are posted to Confluence.
1 - Create your first Space Rule
Let's say you want to move all emails that have a subject that starts with "Chess:" to a space called Chess:
- Go to the configuration page of the "mailto.wiki – Email for Confluence" Add-On (see Getting Started).
- Click on the "Space Rules" tab.
- Click on the "Add Rule" button.

This will open a dialog that will guide you through the process of creating a new Space Rule:
- In the Condition section select "Subject" and "starts with" from the drop-downs. Then enter "Chess:" as a Value into the textbox.
- In the Action section select "move email to" from the Operation drop-down and "Chess" from the Space drop-down.
In the row below select "Page" from the Type drop-down. - Click on the save button in the right bottom corner of the dialog. The button will be grayed-out if there are still errors with your configuration.

The dialog will close and you can now see your newly created space rule in the Space Rules tab. Finally don't forget to click on the Save Settings button.

Now when you send an email to one of your mailto.wiki email addresses with a subject starting with "Chess:" it will automatically get posted to the space Chess as a page instead of getting posted to the default space.


3 - Edit a Space Rule
To edit a space rule, click on the little Edit button next to it. This will open the space rule dialog again. After you made the desired changes to your space rule, don't forget to click on the Save Settings button.

4 - The Difference between move to and copy to
When you create a space rule you can choose between moving an email to a space or copying an email to a space. Moving an email to a space makes it final, all subsequent space rules will not get evaluated. Copying an email to a space means it will also get posted to any further matching spaces including the default space (specified in the Mandatory Settings). Space rules are evaluated from top to bottom.
For example if you have the following space rules defined:

The following example emails would get posted to the following spaces:
Subject | Spaces |
Chess: Boris Spassky vs. Mikhail Tal, USSR Championship, Riga 195 | TAL, CHESS |
Jan Hendrik Winter named employee of the month | Hendrik Winter, the default space |
Chess: Chess Queen on the move | CHESS |
You can rearrange and change the order of space rules with the little arrows next to space rules. Don't forget to click on the Save Settings button after rearranging your rules.

5 - Posting to a subpage instead of the space root
By default when you select Page as content type in space rules emails are added to the root of the page tree in the selected space. You can however also select a page under which emails should get created instead in the space rule dialog.

Then new emails will get posted as sub page of that page:

6 - Posting to a subpage by default
It is currently not possible to set a sub page for the default space in the Mandatory Settings. So if you want to post to a sub page by default you have to create a space rule. As a workaround you can create a phony catch-all rule like so:

Since every email address will contain an @ character this rule will always match. Just make sure that this catch-all rule is the final space rule that you have defined.
7 - Adding labels
You can also use space rules to add labels to pages or blog posts. To do so just enter one or more labels to add to the page into the Labels textbox in the space rule dialog.

Then pages and blog posts that match the space rule will get automatically tagged with these labels.

Conclusion
By using Space Rules you can post to different spaces based on the subject, from and to email addresses. You can also directly post to sub pages and add labels to pages and blog posts. This gives you a lot more fine control than the default space and default content type you can configure in the Mandatory Settings.
If you still have questions about spaces rules or you have any wishes for improvements you can contact us by email at support@mailto.wiki or via the Service Desk. We always like to hear about suggestions for improvements for this manual and the Add-On.