Hello! I hope you will forgive my ignorance but I have a problem I have been trying to solve for a week and I'm not sure where else to turn.

I'm trying to write a sieve script to sort all of my mail. I was writing this script to replace the one I am currently using but I can't seem to get it to compile. I don't know a lot about sieve or really scripting of any kind and I just can't figure out what I'm doing wrong.


The compiler just puts out a bunch of output that doesn't make sense. like "unexpected character" when I know the character works there because I am already running a script with some of the same lines.

I'm attaching the script with some names and addresses changed and the sieve output to this email.

I would greatly appreciate any help anyone could offer.


require ["envelope", "fileinto", "mailbox", "imap4flags", "regex"];

if anyof (header :contains "List-ID" "<linux-kernel.vger.kernel.org>",
          header :contains "List-Id" "Dovecot",
          envelope :domain "From" "lists.ubuntu.com",
          envelope :domain "from" "debian.org",
          envelope :domain "From" "1.example.com",
          envelope :domain "From" "2.example.com",
          envelope :domain "From" "3.example.com",
          envelope :domain "From" "4.example.com",
          envelope :domain "From" "5.example.com",
          envelope :domain "From" "6.example.com",
          envelope "From" "per...@7.example.com",
          envelope :domain "From" "8.example.com",
          envelope :domain "From" "9.example.com",
          envelope :domain "From" "10.example.com",
          envelope :domain "From" "11.example.com",
          envelope :domain "From" "12.example.com",
          envelope :domain "From" "13.example.com",
          envelope :domain "From" "14.example.com",
          envelope :domain "From" "15.example.com",
          envelope :domain "From" "16.ecample.com") {
     if header :contains "List-ID" "<linux-kernel.vger.kernel.org>" {
         fileinto :create "Lists/Kernel";
         stop;
     }
     if header :contains "List-Id" "Dovecot" {
         fileinto :create "Lists/Dovecot";
         stop;
     }
     if envelope :domain "From" "lists.ubuntu.com" {
         if envelope "from" "ubuntu-users-boun...@lists.ubuntu.com"  {
             fileinto :create "Lists/Ubuntu/Users";
             stop;
         }
         if envelope "From" "ubuntu-security-announce-boun...@lists.ubuntu.com" 
 {
             fileinto :create "Lists/Ubuntu/Security";
             stop;
         }
         else {
             fileinto :create "Lists/Ubuntu";
             stop;
         }
     }     
     if envelope :domain "From" "debian.org"  {
         if envelope :contains "From" "debian-user" {
             fileinto :create "Lists/Debian/User";
             stop;
         }
         if envelope :contains "From" "debain-security" {
             fileinto :create "Lists/Debain/Security";
             stop;
         }
         if envelope :contains "From" "debain-security-announce" {
             fileinto :create "Lists/Debain/SecurityAnnounce";
             stop;
         }
         if envelope :contains "From" "debian-news" {
             fileinto :create "Lists/Debain/News;
             stop;
         }
         if envelope :contains "From" "debian-lts" {
             fileinto :create "Lists/Debian/LtsAnnounce";
             stop;
         }
         if envelope :contains "From" "debian-photo" {
             fileinto :create "Lists/Debian/Photo";
             stop;
         }
         else {
             fileinto :create "Lists/Debain";
             stop;
         }
     }
     if anyof (envelope :domain "From" "1.example.com",
               envelope :domain "From" "2.example.com",
               envelope :domain "From" "3.example.com",
               envelope :domain "From" "4.example.com",
               envelope :domain "From" "5.example.com",
               envelope :domain "From" "6.example.com",
               envelope "From" "per...@7.example.com",
               envelope :domain "From" "8.example.com",
               envelope :domain "From" "9.example.com",
               envelope :domain "From" "10.example.com",
               envelope :domain "From" "11.example.com",
               envelope :domain "From" "11.example.com",
               envelope :domain "From" "12.example.com",
               envelope :domain "From" "13.example.com",
               envelope :domain "From" "14.example.com",
               envelope :domain "From" "15.example.com") {
         fileinto :create "Lists/Bulk";
         stop;
     }
     else {
         fileinto :create "Lists";
         stop;
     }
}
if anyof (header "From" "store-n...@amazon.com",
          envelope :contains "From" "menswearhouse.com",
          envelope :contains "From" "officedepot.com",
          envelope :contains "From" "walgreens.com",
          header "From" "pr...@email.newegg.com") {
     fileinto :create "Promo";
     stop;
}
if envelope :contains "From" "facebookmail.com" {
     fileinto :create "SocialMedia";
     stop;
}
if anyof (envelope :contains "From" "creditonemail.com",
          envelope :contains "From" "statefarm.com",
          envelope :contains "From" "capitalone.com") {
    fileinto :create "Banking";
    stop;
}
newfilter: line 100: error: unexpected character(s) starting with '-'.
newfilter: line 100: error: expected end of command ';' or the beginning of a 
compound block '{', but found unknown characters.
newfilter: line 104: error: unexpected character(s) starting with '-'.
newfilter: line 113: error: unexpected character(s) starting with '.'.
newfilter: line 113: error: unexpected character(s) starting with '.'.
newfilter: line 114: error: unexpected character(s) starting with '.'.
newfilter: line 114: error: unexpected character(s) starting with '.'.
newfilter: line 115: error: unexpected character(s) starting with '.'.
newfilter: line 115: error: unexpected character(s) starting with '.'.
newfilter: line 116: error: unexpected character(s) starting with '.'.
newfilter: line 116: error: unexpected character(s) starting with '.'.
newfilter: line 117: error: unexpected character(s) starting with '.'.
newfilter: line 117: error: unexpected character(s) starting with '.'.
newfilter: line 118: error: unexpected character(s) starting with '.'.
newfilter: line 118: error: unexpected character(s) starting with '.'.
newfilter: line 119: error: unexpected character(s) starting with '@'.
newfilter: line 119: error: unexpected character(s) starting with '.'.
newfilter: line 119: error: unexpected character(s) starting with '.'.
newfilter: line 120: error: unexpected character(s) starting with '.'.
newfilter: line 120: error: unexpected character(s) starting with '.'.
newfilter: line 121: error: unexpected character(s) starting with '.'.
newfilter: line 121: error: unexpected character(s) starting with '.'.
newfilter: line 122: error: unexpected character(s) starting with '.'.
newfilter: line 122: error: unexpected character(s) starting with '.'.
newfilter: line 123: error: unexpected character(s) starting with '.'.
newfilter: line 123: error: unexpected character(s) starting with '.'.
newfilter: line 124: error: unexpected character(s) starting with '.'.
newfilter: line 124: error: unexpected character(s) starting with '.'.
newfilter: line 125: error: unexpected character(s) starting with '.'.
newfilter: line 125: error: unexpected character(s) starting with '.'.
newfilter: line 126: error: unexpected character(s) starting with '.'.
newfilter: line 126: error: unexpected character(s) starting with '.'.
newfilter: line 127: error: unexpected character(s) starting with '.'.
newfilter: line 127: error: unexpected character(s) starting with '.'.
newfilter: line 128: error: unexpected character(s) starting with '.'.
newfilter: line 128: error: unexpected character(s) starting with '.'.
newfilter: line 137: error: unexpected character(s) starting with '-'.
newfilter: line 137: error: unexpected character(s) starting with '@'.
newfilter: line 137: error: unexpected character(s) starting with '.'.
newfilter: line 138: error: unexpected character(s) starting with '.'.
newfilter: line 139: error: unexpected character(s) starting with '.'.
newfilter: line 140: error: unexpected character(s) starting with '.'.
newfilter: line 141: error: unexpected character(s) starting with '@'.
newfilter: line 141: error: unexpected character(s) starting with '.'.
newfilter: line 141: error: unexpected character(s) starting with '.'.
newfilter: line 145: error: unexpected character(s) starting with '.'.
newfilter: line 149: error: unexpected character(s) starting with '.'.
newfilter: line 150: error: unexpected character(s) starting with '.'.
newfilter: line 151: error: unexpected character(s) starting with '.'.
newfilter: line 155: error: end of file before end of quoted string started at 
line 152.
newfilter: error: parse failed.

Reply via email to