Say no to “My Party” with Sieve

February 04, 2002
by John Davin
Science & Technology Editor, The Tartan


"My party... It was absolutely amazing!" said the email that many of us received multiple copies of last week. The "My Party" virus arrived in mailboxes everywhere last Monday, spreading quickly partly because it tricked novice computer users into executing the attachment named "www.myparty.yahoo.com" which resembled a web link. The file was actually a Windows .com file which used the Microsoft Outlook and Windows address books to propagate to other computers.

Those of us who use the Mac or Linux operating systems or use pine, have nothing to worry about. Nevertheless, receiving a new copy of the same email every hour or two can become quite annoying. In this case, the answer to our prayers is the sensibly named Sieve. Sieve is a Unix program that allows Carnegie Mellon students to filter the email they receive to their Andrew address.
Cyrusoft's Mulberry mail client (version 2.1 and higher) has an easy to use graphical tool for setting up Sieve mail filters. This is the simplest way to start using mail filters, but if you don't use Mulberry or don't feel like downloading version 2.1, you can set up mail filters through Unix.
To begin, you need to make a file, which can be named ".sieve" for convenience, in your Andrew file space. You can do this using pico or a similar program while telneted into a Unix computer, or create the file separately and FTP it to your Andrew space.
To reject emails containing the My Party virus, you would simply enter the following commands into the .sieve file:

require "reject";
if header :contains "Subject" "new photos from my party!" {
reject "You have the My Party virus! Please get rid of it.";
}

After you have placed the completed script in your Andrew home directory, you need to enter the following commands into a telnet window:
sieveshell cyrus.andrew.cmu.edu
put .sieve
activate .sieve
quit

You should replace ".sieve" with the name of your script file if you named it differently.
Remember that it is important to use the exact syntax and to consider cases where you could reject an email that you didn't intend to reject. For example, if you used the example above, you could end up rejecting an email from one of your friends sending actual photos of a party. And you certainly don't want that to happen. So a better idea is to use filtering to automatically file the mail into a mail folder. This is accomplished by a .sieve file with the following contents:

require "fileinto";
if header :contains "Subject" "new photos from my party" {
fileinto "INBOX.spam";
}

You must have a "spam" folder already created in your mail system. Don't forget to repeat the sieveshell commands to update your sieve file on the Cyrus server. The code above will automatically send any emails with the correct subject line to your Inbox.spam folder instead of to your regular Inbox folder. This allows you to get spam mail out of the way without risk of rejecting legitimate mail. The fileinto command is also useful for simply sorting your email. If you're like most Carnegie Mellon students, you probably get lots of mail each day. You can use fileinto to sort your mail into different folders - for example, if you regularly receive a newsletter from someone with an email address of acarnegie@andrew.cmu.edu, you can use the following lines to automatically file it into a folder:

require "fileinto";
if header :contains "From" "acarnegie@andrew.cmu.edu" {
fileinto "INBOX.importantppl";
}

Complete instructions and a link to the Sieve manual page are available at http://www.cmu.edu/computing/documentation/sieve/sieve.html.