Linux.com

Home News Software Applications Extending Claws Mail with Plug-Ins and Filters

Extending Claws Mail with Plug-Ins and Filters

Recently I introduced the Linux.com community to a very powerful email client, Claws Mail. This client is a tool that should make both new users and power users at home. But if the basic functionality isn't enough, you can extend the Claws Mail feature set with the help of plug-ins and filters. With plug-ins you can add such features as:
  • ACPI Notify: Mail notification via laptop LEDs.
  • Attachment warning: Warns if you have mentioned an attachment but forgot to add the attachment.
  • CacheServer: Saves a cache of your email work every sixty seconds.
  • GtkHTML2Viewer: View HTML mail.
  • Mail Archiver: Archive email folders.
  • MailMBOX: Add support for mbox formatted mailboxes.
  • Notification: Add different types of notification when new mail arrives.
  • Perl: Extend filtering capacity by adding a Perl interface to the Claws Mail filtering tool.
  • RSSyl: Add RSS feeds.
  • SynCE: Sync addressbook with a Windows CE device.
and more...
 
Equally as extensible is the filtering mechanism with Claws Mail is very reliable and flexible.  With filtering you can take the following actions on incoming email:
  • Move
  • Copy
  • Delete
  • Hide
  • Set flags
  • Execute commands
  • Label
  • Resend
  • Score
  • Flag
  • Ignore/Watch thread
  • Add to addressbook
And like the plug-ins, filtering is simple enough that a new user can handle the task, and flexible enough to keep power-users happy.
 
With all of that said, let's take a look at how each is set up.

Plug-ins

The Claws Mail plug-in system is simple to use. But before you can use it, you need to make sure you have all of the plug-ins you want installed. Go back to your Add/Remove Software utility (such as Synaptic or gpk-application) and follow these simple steps:
  1. Do a search for "claws" which will reveal all software related to Claws Mail.
  2. Go through the list and select for installation all of the extras you want.
  3. Click Apply to install the software.
Once you have all of the plug-ins you want/need it is time to enable them and configure them (if needed).

The first step is to enable the plugin you want to use. To do this go to the Configuration menu and select the Plugins entry which will open the Plugins window (see Figure 1).

Claws Mail plugins windowThis window should be fairly self explanatory. To add a plugin you click the Load button and select the plugin you want to load. Each plug-in is in the form of an .so file and is located in the /usr/lib/claws-mail/plugins folder. This is useful if you download a plugin that does not have an installation candidate.

You can see (in Figure 1) that if you click on a plug-in in the left pane a description of the plug-in will appear in the right pane. This can come in handy because some of the plug-in names are not terribly descriptive. Also, if you want to unload a plug-in just select the plug-in and click the Unload button.

Once the plug-in is loaded that plug-in will appear in the Preferences window under the Plugins listing. This is where you will configure your plug-ins. Some plug-ins have configuration options and some do not. Let's take a look at loading and configuring the GtkHTML2 Viewer. This plug-in allows you to view HTML email (without which all HTML email will be rendered as a text message.)

To load up the GtkHTML2 Viewer plug-in follow these simple steps:
  1. Open up the Plugin window from within the Configuration menu.
  2. Click on the Load button.
  3. Scroll down until you see the gtkhtml2_viewer.so file and click the Open button.
The plug-in is now ready to configure. Go back to the Preferences window and scroll down until you see the GtkHTML2 View entry. Click on that entry to reveal the available configuration options (see Figure 2).

GtkHTML2 ViewerThe configuration options available for this plugin are:
  • Automatically load images: If you enable this images will load as soon as you view the email. A smart choice is to also enable this feature only for senders in your address book.
  • Cache Images locally: This will cache images on your machine so when you to view an email again you won't have to re-download it.
  • Clear image cache on exit: This will clear out all images in the cache when you exit Claws Mail.
Those are all of the options available for the GtkHTML2 Viewer plugin. Other plug-ins will have different options available. Some plug-ins do not have any options available - they are just on or off.

Filters

The filtering system in Claws Mail is very powerful. With this system you can do many things. Let's take a look at setting up both a simple filter and a more complex filter in Claws Mail. You can create filters in two different ways:

  • You can right-click an email and select a filter type from the "Create Filter Rule" menu.
  • You can open up the Filtering window from the Configuration menu.
Let's create a filter using the Filtering Window. Click on the "Filtering" entry in the Configuration menu and the Filtering window will open (see Figure 3).

FilteringHere are the steps for creating a filter:
  1. Give your filter a name.
  2. Apply your filter to an account.
  3. Define a condition.
  4. Define an action.
  5. Add the filter.
  6. Close the window.
Now let's break these steps down.

1. Give your filter a name. This is pretty much as you would expect. Remember, each filter will need to have a unique name.
2. Apply your filter to an account. If you have more than one account you can select a particular account for this filter to work with. You can also set this filter to work with All accounts. "All" is the default.
3. Define a condition. When you click the "Define" button next to the Condition section a new window will open (see Figure 4). This window is where you define what criteria an email must meet before the filter will be applied.

Conditions definingOnce you have defined your criteria for your condition make sure you click the Add button. You can add more than one criteria for this condition. When you add more than one criteria make sure you have their order selected properly. For instance if you want to filter all email from sender X that is older than Y you must first filter the email by X before you filter the email by Y. You can move a condition up or down the list by selecting a condition and clicking either the Up or Down button. For a simple filter you would most likely have only one criteria - such as an email address. Let's say you get email from your favorite distribution's mailing list and you want to have it all moved to a specific folder. For this select Header from the Match Criteria drop down which will change the upper pane so you can select other options. Now select "To" from the Name drop down because most distribution mailing list addresses will be in the "To" field of the header. In the Header section make sure "Contains" is selected. Now enter the address in the text area next to the Header section. When you have finished with the address, click the Add button.

You could make this filter a bit more complex. Let's say you want to keep the current days mailing list traffic in your main folder but any older mail is sent to an specific folder for archiving purposes. You can then add another Criteria by selecting Age from the Criteria drop down, selecting "More Than", "1", and "days" from the Age criteria section. Once you have configured this criteria click the Add button.

With all of your conditions added click the OK button to return to the Filter Configuration window so you can define your action(s).

4. Define an action. This is where you configure what happens to the email that meets the condition criteria. Click on the Define button next to the Action section which will open up yet another new window (see Figure 5). In this new window you first must select an action to take place. Depending upon what action you select, the next configuration options will change.

Actions definingLet's say you want to move all email that match the criteria to a specific folder. For this select "Move" from the Action drop down and then select the folder you want to move the email to in the Destination section. If the folder doesn't already exist you can create it by clicking the "New" button in the Destination window. Once you have configured this click the Add button and then click OK.

5. Add the filter. Before you click the OK button in the Filter Configuration window make sure you click the Add button to add the new filter. When the filter is added you will see it in the list. With the filter added click OK and you are done.

Final Thoughts

You have just walked through two areas where Claws Mail can be extended. Both plugins and filters allow you to take your standard email client and give it much more power. Play around with the filters so you can create more and more powerful filters to make Claws Mail keep your email organized. But don't think this outstanding email client is limited to only plugins and filters. There are plenty of other configuration options that will help you make Claws Mail much more powerful.
 

Comments

Subscribe to Comments Feed

Who we are ?

The Linux Foundation is a non-profit consortium dedicated to the growth of Linux.

More About the foundation...

Frequent Questions

Join / Linux Training / Board