Sieve with multiple condition

I have a running email gateway where we copy all emails in the domain into one email for archiving.

For example: email1@domain.com, email2@domain.com all have their emails copied into an account called backup@domain.com

After a while it gets messy because all accounts are backed up into one inbox.

So my plan is to apply sieve to route the emails to separate folders in the backup email account. I.e: INBOX.Email1, INBOX.Email2 and so on.

I thought to do this by using something like this:
Elsif address :contains ["To"] ["email1@domain.com"] {fileinto "INBOX.Email1"}
Elsif address :contains ["To"] ["email2@domain.com"] {fileinto "INBOX.Email2"}
and so on

My question is:
1. Is that the right command to use?
2. Can I use multiple elsif like so?
3. What if an email is directed to multiple person? For example, to email1 and email2 ? This would mean both the condition in the example above are met. So where would the email go to?

Thank you
SW111Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

sweetfa2Commented:
That is the right command to use.

I would not use the Elsif (I would use the straight if) to overcome your question 3.

In your question 3 it would go to the first person only.  Using IF a copy would be logged in each users inbox.

There is no limit to the number of elsif that can be used.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
SW111Author Commented:
Thanks Sweefa2, can I clarify:

I actually dont want to backup multiple copies of the email as the backup account gets very big very quickly.

But, when using the above command, I suppose it will not include the cc and bcc field?

I mean, if I want to specify:
IF (there are many address)
THEN (put in separate folder for general emails)

Honestly I dont know how the rule is suppose to be yet with multiple addresses, but I'm trying to figure out my options.
0
sweetfa2Commented:
In that case ladder logic applies and the first rung that meets the condition will be met.

So in your case you put the multiple recipients cases first before the single cases.  You would be using the elsif clauses in this case.  That will remove the multiples from the single addressees.  The issue with that will be what is a general broadcast, and what is a genuine address to both parties.  It depends what you are aiming for with your intent.

I believe you can also test on the CC and Bcc fields of the header, although I cannot find a syntax reference to check at this point.
0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

SW111Author Commented:
Ok. Thanks Sweetfa2, I'll go ahead and try it.
0
SW111Author Commented:
Sweetfa2, can I ask a quick question?

What if I want to store everything sent from our domain into INBOX.Sent folder,
EXCEPT a particular account A1@domain.com that should go to INBOX.Sent.A1 ?

Can I do:

Elsif address "contains ["From"] ["a1@domain.com"] {fileinto "INBOX.Sent.A1"]
Elsif address "contains ["From"] ["@domain.com"] {fileinto "INBOX.Sent"]

I.e, will the top rule takes priority over lower rules?

Thank you
0
sweetfa2Commented:
The top rule will take priority if the second condition is els if (the way you have it).

Just be sure the first condition starts with IF and not ELSIF :)
0
SW111Author Commented:
Okay, I must have misunderstood something here...
I had assumed there can be only 1 if ?
so it goes like this:

IF
ELSIF
ELSE
exit

Or can we do:

IF
ELSIF
IF
ELSIF
ELSE
exit

Because I already put the first condition to filter spam
IF spam tagged, fileinto spam folder.

Thanks
0
sweetfa2Commented:
You can have as many if's in their own right as you want.

Only one statement from each IF block can be processed, but you can end up with multiple actions occurring if you have multiple IF's.
0
sweetfa2Commented:
In other words, your second variant is acceptable.
Sieve Tutorial
0
SW111Author Commented:
:) Thanks Sweetfa
Glad you sent the last post because its going to take me the whole night to figure out the last sentence of the post before last
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Email Servers

From novice to tech pro — start learning today.