# Sieve Filter
# Erzeugt von Ingo (http://www.horde.org/ingo/) (30.09.2016, 16:02)

# Nested rules aren't supported and will be ignored (#5540)

require ["fileinto", "vacation", "regex"];

# Abwesenheit
if allof ( not exists ["list-help", "list-unsubscribe", "list-subscribe", "list-owner", "list-post", "list-archive", "list-id", "Mailing-List"],
  not header :is "Precedence" ["list", "bulk", "junk"],
  not header :matches "To" "Multiple recipients of*") {
    if header :regex "Received" "^.*(2016) (\\(.*\\) )?..:..:.. (\\(.*\\) )?(\\+|\\-)....( \\(.*\\))?$" {
    if header :regex "Received" "^.*(Oct) (\\(.*\\) )?.... (\\(.*\\) )?..:..:.. (\\(.*\\) )?(\\+|\\-)....( \\(.*\\))?$" {
    if header :regex "Received" "^.*([0 ]4|[0 ]5|[0 ]6|[0 ]7) (\\(.*\\) )?... (\\(.*\\) )?.... (\\(.*\\) )?..:..:.. (\\(.*\\) )?(\\+|\\-)....( \\(.*\\))?$" {
    vacation :days 7 :addresses "test@company.com" :subject "vacation" "blablabla";
}
}
}
}

if address :contains ["From"] "domain.net" {
    if address :contains ["From"] "foo" {
        fileinto "Domain.Foo";
    } elsif header :contains "Subject" "bar" {
        fileinto "Domain.Bar";
    } else {
        fileinto "Domain";
    }
}

if header :contains "Subject" ["TAG"] {
    fileinto "Tagged";
}

# Ausgeschlossene Adressen
if address :is ["From", "Sender", "Resent-From"] "noreply@example.org"  {
    discard;
    stop;
}
