Section 3.2. I m Drowning in Good Email


3.2. I'm Drowning in Good Email

I spend a lot of time every morning sifting through email. A lot of it comes from various Linux mailing lists. Many of you may receive several hundred messages every day, just from the Fedora mailing lists.

Luckily, you can use the capabilities of your mailer to search through headers, email addresses, message bodies, and more to prioritize your good email. Because this book is for geeks, I've chosen a slightly advanced topic: how to set up virtual folders on Evolution. This lets you view mail in many different ways. For instance, you can view all the mail regarding a particular project from different people and then with a single click view all the mail from a particular person on all projects. The same mail messages will appear in different folders, matching whatever criteria you specify.

To understand virtual folders, consider a quick comparison of mail messages to files. If you move a file, it's no longer accessible in the old directory. If you want to access the file in two different directories, you can copy it, but then anything you do to one has to be repeated on the other. How can you access a single file in two different directories and make sure that anything done to a file in one directory is reflected in the copied file in the other directory?

The solution for files is links. The same solution in Evolution is virtual folders. Mail remains in one real folder, but it can show up simultaneously in any number of virtual folders, and if you delete it or mark it in some way, the action takes place everywhere it appears.

In this section, I'll show you step by step how to set up a virtual folder. To help you understand how they work, I've cited the specific steps I used to identify all emails to and from my agent:

  1. Open Evolution.

  2. If you're not already in the email manager, click the Mail button, or press Ctrl-F1 or Ctrl-1.

  3. Choose File New Mail Folder, or Shift-Ctrl-F, to open the Create Folder window.

    In the Folder Name text box, enter the name you want to use. In this case, I've entered Agent. Highlight VFolders and click Create to open the New VFolder window.

  4. Click Add to start adding filtering rules.

    One choice you have is to make the folder group messages together with the following messages that answer them; this is called threading. Because the rules will search through all email messages in my Inbox and Sent mail folders, I do not need to include threads. However, it might be useful for threads on mailing lists such as those related to the Fedora Project.

  5. If you're going to specify more than one rule, you'll want to choose the appropriate option in the Execute Actions drop-down menu: "if all criteria are met" or "if any criteria are met." In my case, I want all criteria to be met.

  6. Under the Add button, select the search criteria of your choice in the lefthand drop-down text box. What you select determines the options that follow. In this case, I select Sender, and then "contains" in the next drop-down menu. I then enter the name used by my agent in her email addresses.

  7. I want more than one search criterion, so I click Add. I want to make sure the message is from my agent, so I specify Message Body in the first drop-down menu and "contains" in the next drop-down menu. I enter the first name of my agent, fairly secure in the knowledge that Carole is a somewhat uncommon spelling.

  8. Since I want a listing of all communication to and from my agent, I select "all local folders" under the VFolder Sources in the drop-down text box.

    Evolution won't search through the Junk folder.

  9. Alternatively, if you want to limit the search to the Inbox, select the "specific folders only" option in the drop-down menu. Click Add, and then navigate to and select the Inbox folder. You'll see the "mbox:Inbox" listing.

    Even if you specify "mbox:Junk", Evolution won't search through the Junk folder.

  10. Alternatively, if you want to search through remote folders, such as those available from an IMAP server, you can change the drop-down menu to "with all active remote folders" or "with all local and active remote folders."

  11. Once complete, click OK. It may take a bit of time to collect the messages in virtual folders, especially if you've created filters that search within messages or from remote servers.

3.2.1. Filtering Spam with Evolution

There are several excellent email managers available for Linux, including Thunderbird, Kmail, Evolution, and pine. My selection of Evolution is somewhat arbitrary, based on how it closely resembles Microsoft's Outlook and how it can be integrated with the Microsoft Exchange email server. While KOrganizer also supports much of the same functionality, it does not have the same level of popularity. Evolution is the default email manager for both Red Hat and SUSE distributions.

SUSE has only recently moved toward GNOME and Evolution, to reflect its ownership of Ximian, the developers of Evolution.


However, Evolution is a big package. If you do not need the non-email features associated with a Personal Information Manager (PIM), you may want to use a a simpler email manager, such as Thunderbird, Kmail, or pine.

Because spammers don't label their email as undesirable, some trial and error is required to manage this problem. Filters are not 100 percent reliable; you may need to accept some spam for the sake of making sure that you do see important email.

Once you activate the Evolution spam filter, you'll need to check your junk mail folder periodically, to make sure that important messages aren't accidentally classified as spam.


The kind of spam that users want to filter may vary. For example, one user may appreciate discount ticket offers on Airline X; another may have a fear of flying and would therefore never want to see any airplane-related email. Associated features in Evolution allow individual users to customize their junk email filters.

3.2.1.1. Installing SpamAssassin

Before you can activate junk mail filtering on Evolution, you need to install the SpamAssassin package on your workstations. It's available for each of our selected distributions, under an RPM or DEB package of the same name.

SpamAssassin includes Bayesian filtering, an algorithm that uses probabilities to calculate the likelihood that a specific email is junk. For example, Viagra is a common word in junk email; however, if you work for the company that produces Viagra, related emails may be serious business.

SpamAssassin includes a substantial number of tests for junk email, as documented at http://spamassassin.apache.org/tests_3_0_x.html. These tests are associated with configuration files in the /usr/share/spamassassin directory.

The details of how you can customize SpamAssassin covers an entire book of the same name, Spam Assassin by Alan Schwartz (O'Reilly). One tip from that book is that SpamAssassin supports whitelists and blacklists for specific email addresses or domains. You can include directives such as:

 whitelist_from guru@linuxexam.com blacklist_from *@spamisus.abc 

3.2.1.2. Activating spam filtering

Spam filters are available on email servers, and they can be quite helpful. But they may not be enough for you or your users. Evolution includes a customizable spam filter, which takes advantage of SpamAssassin features. Set it up as follows:

  1. Access Evolution Settings by choosing Tools Settings (or for some versions of Evolution, Edit Preferences).

  2. In the righthand pane of the window, select the Junk tab.

  3. Activate the Check Incoming Mail For Junk option.

    The Check Incoming Mail For Junk option checks against a database of known junk messages as well as anti-spam blacklists.

  4. If you have ample speed on your Internet connection, you may choose to activate the Include Remote Tests option.

    The Include Remote Tests option checks against a SpamAssassin-compiled list of blacklisted message senders and ISPs. This option can slow down email delivery and, in some cases, slow your effective Internet connection. It can lead to other problems; for example, the IP address used by my domain was for a while also used by a known spammer. Some of my emails were automatically filtered as junk by several ISPs.

  5. Click Close. Your Junk folder should now be active.

    While the Junk folder is now active, you still need to add messages to the junk filter. You'll also need a spam folder for the detailed filters. In the main Evolution screen, click the Mail button. Right-click on a folder and select New Folder from the pop-up menu that appears. Enter an appropriate name for a folder; I've created a folder named Spam. In the Specify Where To Create This Folder window, highlight On This Computer and click Create.

You now have a Spam folder for your filters.

3.2.1.3. Junk filters

Filtering is a routine feature of most modern mailers. You can configure a mailer to put mail from certain sources in certain folders, delete certain types of messages automatically, or even send messages to a program to do some automated processing, such as generating a reply. In this section, we use this powerful feature in Evolution to send the messages you predict to be spam to their own folder.

The easiest way to start filtering spam is to mark it as such. For example, check your Trash folder. You probably have a lot of spam there. One popular type of junk email is "phishing" for your personal financial information. Naturally, if you don't have an account from that institution, you'll know it's spam.

To add a spam email to your filters, highlight the message and click Junk. If the Junk button is grayed out (and the Not Junk button is active), it's already been recognized as spam by your filter criteria.

3.2.1.4. Spam filters

You can also create your own rules, such as whitelists and blacklists. To do so, click Tools Filters to open a window of the same name. Any filters already in this list were created by others. Make sure Incoming (and not Outgoing) is selected in the top drop-down menu. Click Add. This opens the Add Rule window shown in Figure 3-3.

Figure 3-3. Adding a spam filter rule


As you can see in Figure 3-3, I have created a simple rule for emails from the spammer@spam.spm email address. All email from that address will be transferred to the Spam folder. But spam isn't that simple. You can add as many rules as you need for your test. In place of Sender, you can specify a number of different conditions, shown in Table 3-2. As you can see in the "Execute actions" drop-down menu, you can classify a message as spam if any or all of your conditions are met.

Table 3-2. Spam conditions

Condition

Description

Sender

The email address associated with the From: directive.

Recipients

The email addresses in the To: and cc: directives.

Subject

Information in the Subject: directive.

Specific Header

Supports selections from any header you choose.

Message Body

Uses text you supply to search through a message.

Expression

Allows programmers to filter in the Scheme programming language (related to LISP).

Date Sent

Supports filtering based on actual or relative time.

Date Received

Supports filtering based on actual or relative time.

Label

If you have labels for your emailse.g., Work, Personal, or To Doyou can add that criterion to your filter here.

Score

Assigns a message score for further filtering.

Size

Helps you filter out messages that may be suspiciously large.

Status

If you already have a message in an existing folder such as Drafts or Junk, you can add the messages to the filter list.

Follow-Up

Checks if message is flagged for a follow-up.

Attachments

Checks if attachments are included with the email.

Mailing List

Supports filtering based on a mailing-list address.

Regex Match

Allows the use of grep to search through a message header or body.

Source Account

Filters the account based on the source email server.

Pipe To Program

Supports the use of piping to an external program, such as another spam filter.

Junk Test

Filters based on the results of the test.


If you're not satisfied with SpamAssassin, one alternative is Bogofilter (http://bogofilter.sf.net). Whatever spam-filtering tool you select, you can use the Pipe to Program rule to filter your email through its filter; if the message is identified as spam, you can set its status to Junk. Once configured, email that meets the conditions identified by your spam filter is sent to your Junk folder.



Linux Annoyances for Geeks
Linux Annoyances for Geeks: Getting the Most Flexible System in the World Just the Way You Want It
ISBN: 0596008015
EAN: 2147483647
Year: 2004
Pages: 144
Authors: Michael Jang

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net