Skip to content

Instantly share code, notes, and snippets.

@merrilymeredith
Created May 31, 2017 16:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save merrilymeredith/9eae16f1770b07e9491ec051d354bf54 to your computer and use it in GitHub Desktop.
Save merrilymeredith/9eae16f1770b07e9491ec051d354bf54 to your computer and use it in GitHub Desktop.
Practical sieve examples seem kind of scarce, so...
# vim: ft=sieve
require "imap4flags";
require "fileinto";
require "copy";
if address :domain :is ["from", "to", "cc", "bcc"] "frobtech.com" {
addflag "frobtech";
if address :all :is "to" "report@frobtech.com" {
addflag "\\seen";
fileinto "Trash";
}
}
if anyof (address :is "to" "meredith@quux.org",
header :is "list-id" "<quux.yahoogroups.com>",
header :is "list-id" "<quux.googlegroups.com>",
address :is "reply-to" "webmaster@quux.org") {
addflag "quux";
}
if header :is "list-id" "<jobs.perl.org>" {
fileinto "Lists.perl-jobs";
}
if header :matches "x-original-to" ["root", "postmaster", "mailer-daemon*"] {
fileinto "Alias.root";
}
if anyof (address :is "from" ["deliverysupport@safeway.com",
"service@chewy.com",
"billpayer@customercenter.net"],
allof (address :is "from" "safeway@email.safeway.com",
header :matches "subject" "Reminder: Delivery * today")) {
redirect :copy "xyzzy@gmail.com";
}
if allof (address :is "from" "leasing@landlord.com",
header :is "subject" "Package Notification") {
redirect :copy "foo@gmail.com";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment