Commit 12f56edd 12f56edd0266292a4b55f45211c225a360b1188b by Sam Roberts

Commiting my example/test sieve scripts so I can maintain them with cvs

(I use them at work and home).
1 parent c1b88956
From coyote@desert.example.org Sun May 6 22:16:47 2001
From: coyote@desert.example.org
To: roadrunner@acme.example.com
Subject: I have a present for you
X-Caffeine: C8H10N4O2
Look, I'm sorry about the whole anvil thing, and I really
didn't mean to try and drop it on you from the top of the
cliff. I want to try to make it up to you. I've got some
great birdseed over here at my place--top of the line
stuff--and if you come by, I'll have it all wrapped up
for you. I'm really sorry for all the problems I've caused
for you over the years, but I know we can work this out.
--
Wile E. Coyote "Super Genius" coyote@desert.example.org
From b1ff@de.res.example.com Sun May 6 22:17:15 2001
From: youcouldberich!@reply-by-postal-mail.invalid
To: rube@landru.example.edu
Subject: $$$ YOU, TOO, CAN BE A MILLIONAIRE! $$$
Date: TBD
YOU MAY HAVE ALREADY WON TEN MILLION DOLLARS, BUT I DOUBT
IT! SO JUST POST THIS TO SIX HUNDRED NEWSGROUPS! IT WILL
GUARANTEE THAT YOU GET AT LEAST FIVE RESPONSES WITH MONEY!
MONEY! MONEY! COLD HARD CASH! YOU WILL RECEIVE OVER
$20,000 IN LESS THAN TWO MONTHS! AND IT'S LEGAL!!!!!!!!!
!!!!!!!!!!!!!!!!!!111111111!!!!!!!11111111111!!1 JUST
SEND $5 IN SMALL, UNMARKED BILLS TO THE ADDRESSES BELOW!
# cmu-sieve/sv/Makefile
test: INBOX
./Test 2>&1 | tee test.out
.PHONY: INBOX
INBOX:
cp INBOX.orig INBOX
t-%: t-%.sv INBOX ../sieve
../sieve -vvv -f INBOX $<
.PHONY: ../sieve
../sieve:
make -C .. sieve
if size :under 500K {
discard;
}
keep;
if size :over 550 { # this is a comment
discard;
}
require "fileinto";
if anyof (
not exists ["From", "Date"],
header :contains "from" "fool@example.edu"
)
{
discard;
}
if header :contains "from" "coyote"
{
fileinto "popbox"; # "pop://sam:passwed@fw";
}
if header :contains :comparator "i;octet" "Subject"
"MAKE MONEY FAST" {
discard;
}
require "fileinto";
if header :contains "from" "coyote" {
discard;
} elsif header :contains ["subject"] ["$$$"] {
discard;
} else {
fileinto "INBOX";
}
if header :contains ["From"] ["coyote"] {
redirect "acm@example.edu";
} elsif header :contains "Subject" "$$$" {
redirect "postmaster@example.edu";
} else {
redirect "field@example.edu";
}
require ["fileinto", "reject"];
require "fileinto";
# require "vacation";
require "reject";
if header :contains "from" "coyote@desert.example.org" {
reject
"I am not taking mail from you, and I don't want
your birdseed, either!";
}
require "fileinto";
if header :contains ["from"] "coyote" {
fileinto "INBOX.harassment";
}
if size :under 1M { keep; } else { discard; }
if not size :under 1M { discard; }
if header :contains ["from"] ["idiot@example.edu"] {
discard;
}
if address :is :all "from" "tim@example.com" {
discard;
}
# header :is ["X-Caffeine"] [""] => false
# header :contains ["X-Caffeine"] [""] => true
# These should be true, then, and not affect the test mbox.
if header :is ["X-Caffeine"] [""] {
discard;
}
if not header :contains ["X-Caffeine"] [""] {
discard;
}
#
# Example Sieve Filter
# Declare any optional features or extension used by the script
#
require ["fileinto", "reject"];
#
# Reject any large messages (note that the four leading dots get
# "stuffed" to three)
#
if size :over 1M
{
reject text:
Please do not send me large attachments.
Put your file on a server and send me the URL.
Thank you.
.... Fred
.
;
stop;
}
#
# Handle messages from known mailing lists
# Move messages from IETF filter discussion list to filter folder
#
if header :is "Sender" "owner-ietf-mta-filters@imc.org"
{
fileinto "filter"; # move to "filter" folder
}
#
# Keep all messages to or from people in my company
#
elsif address :domain :is ["From", "To"] "example.com"
{
keep; # keep in "In" folder
}
#
# Try and catch unsolicited email. If a message is not to me,
# or it contains a subject known to be spam, file it away.
#
elsif anyof (
not address :all :contains
["To", "Cc", "Bcc"] "me@example.com",
header :matches
"subject" ["*make*money*fast*", "*university*dipl*mas*"]
)
{
# If message header does not contain my address,
# it's from a list.
fileinto "spam"; # move to "spam" folder
}
else
{
# Move all other (non-company) mail to "personal"
# folder.
fileinto "personal";
}
# an empty script
require "fileinto";
fileinto "./_save-all.mbox";
# Example sieve script.
require "fileinto";
if size :over 20 {
fileinto "/home/sam/p/gnu/mailutils/cmu-sieve/sv/inbox";
}
if address :domain :is "to" "uwaterloo.ca" {
redirect "dom@is.uw";
}
if header :is "Status" "RO" {
redirect "status@is.ro";
}
keep;
if size :over 100K { /* this is a comment
this is still a comment */ discard /* this is a comment
*/ ;
}
require "envelope";
if envelope :all :is "from" "tim@example.com" {
discard;
}
require "fileinto";
if exists "subject"
{
fileinto "subject";
}
require "fileinto";
if allof(
size :over 10 ,
exists "x-caffeine"
)
{
fileinto "jetfuel";
}
else
{
fileinto "decaf";
}
require "fileinto";
if header :contains ["to", "cc"] "bug-mailutils@gnu.org"
{
fileinto "+l.mailutils";
}