View Single Post
Old 21 Aug 2017, 10:58 PM   #6
jhollington
Essential Contributor
 
Join Date: Apr 2008
Posts: 371
Quote:
Originally Posted by dgittings View Post
Is there some way of writing a rule so that copies of an incoming email are filtered into multiple folders? Perhaps in sieve? (although I'm not really very familiar with sieve) I've spent ages puzzling over this, but haven't figured out a way of doing this so far?
The forwarding method that misc describes should work fine, and it's kind of a clever workaround without having to delve into Sieve, although it's perhaps not as "clean" of a setting under the hood, as you won't be getting an exact copy of the message in terms of headers — the second one will be a message that you sent back to yourself, and could end up getting processed by other rules or possibly even identified as spam in some cases.

It is possible to do this via Sieve, but you have to do it at least semi-manually. The key is that the "fileinto" directive in Sieve can have a ":copy" parameter added after it to copy the message to a folder, preserving the original. Sieve code to do this would look something like this:

Code:
if address :is "From" "somewhere@somedomain.com" {
  fileinto :copy "INBOX.FirstFolder";
  fileinto "INBOX.Final-Destination";
}
You can have as many "fileinto" directives as you like to copy the message to multiple folders, just using ":copy" on all of them except for the last one, since you'll likely want the last operation to move the message rather than copying it (on the other hand, if you want the message left in your inbox, simply leave any final non-copy line off).

If you're not comfortable crafting Sieve by hand, you can also build the basic rule from the standard "Rules" settings and then just copy and paste it into your own section — all standard rules that you create are displayed in the advanced Sieve editing screen, in the greyed-out blocks between those sections you can edit yourself.

So in that case, you would create a normal rule to move a message to another folder. You'd then go into the "Edit Custom Sieve" code section and find that rule, which should be under "7. Sieve generated for organise rules". You can then just copy and paste it to the editable section below that, add the ":copy" parameter after the "fileinto" and add any other "fileinto" directives you want for copying it to additional folders. Just be sure to go and delete the original "move" rule once you've done this, otherwise that will still take precedence.
jhollington is offline   Reply With Quote