Difference between revisions of "Using Claws Mail with other programs"

From Claws Mail FAQ
Jump to navigationJump to search
m (updated)
Line 82: Line 82:
=== How can I use Claws Mail with SpamAssassin? ===
=== How can I use Claws Mail with SpamAssassin? ===
To train spamassassin in Sylpheed-Claws (>=1.9.6):
To train spamassassin in Claws Mail (>=1.9.6):
Menu > Configuration > Actions
Menu > Configuration > Actions

Revision as of 09:33, 9 March 2007

How can I use Claws Mail with bogofilter?

First of all, make sure you have trained bogofilter; for different training methods, see http://bogofilter.sourceforge.net/faq.shtml#training. Method 4 is recommended, but requires a large number of ham and spam messages.

Add a new filtering rule: you need a filtering condition which runs bogofilter on incoming messages; and an action that has to be performed if the message was recognised as spam. Go to the Filtering Configuration dialog, and type the following in the condition entry field:

test "bogofilter -u < %F"

Note 1: this assumes that bogofilter is in your path!
Note 2: the -u parameter of bogofilter registers the message automatically as either spam or ham.

Next add an action in the Action field. The best way is to use the Define... button next to the field. As an example, if you wanted to move a spam messages to a directory called Spam, then the final action, put in the field, could look like this:

move "#mh/Mailbox/Spam"

After having added the filtering rule you probably want to create two Claws Mail Actions: one for marking messages as spam, and one for marking messages as ham. These actions can be used to correct bogofilter and/or to train it with additional messages. For example, if the above filtering rule did not detect a spam message correctly, delivering it to your inbox, you can manually correct this by invoking a "Mark As Spam" action. As an added bonus, Actions are automatically added to the main menu (under Tools|Actions), and can also be added to the main toolbar.

Open the Actions dialog (Configuration | Actions...). In the Menu name field, enter the following:

Mark As Spam

This is just the text as it would appear in the Tools|Actions submenu.

The accompanying command line for Mark As Spam should be:

bogofilter -Ns -B %F

(Don't forget to use the Add button!)

Likewise, the same thing you should do for marking messages as ham. Select "New" in the Current actions list, and enter the following in the Menu name:

Mark As Ham

The command line for this action should be:

bogofilter -Sn -B %F

And add the action by clicking the Add button.

This gives you a basic setup for bogofilter and Claws Mail.

How can I use Claws Mail with Popfile?

You can reclass messages received trough a Popfile filter with a header link or a button in Claws Mail. Popfile lives @ http://popfile.sourceforge.net/

First read the Popfile documentation on how to set up the mail client to use Popfile.

You have 2 options to reclass received messages: a simple one (header link) and a difficult one (toolbar button).

1) Simple method

  • Open the Popfile control center, go to the "Buckets" tab, and make sure ALL buckets have the X-POPFile-Link Header turned on.
  • Open Claws Mail preferences window, go to Message view -> Text options.
  • Edit the header display options, in the "Displayed header configuration" dialog add X-POPFile-Link to the displayed headers.
  • All messages received via Popfile will have a header link (just above the message body) called X-POPFile-Link, something like this: X-POPFile-Link: - you can click on it and Claws will open the link with the browser you set up in preferences.

2) difficult method

You will need 3 things:

  • a bash script
  • a Claws Mail action
  • change Popfile configuration a bit.

The bash script:

url=`cat $1 | grep -e X-POPFile-Link:.* -o|grep http.* -o`
firefox $url

Save it as /some/path/popreclass.sh
Change firefox to another browser executable if needed.

The action:
/some/path/popreclass.sh "%f"
You can set up a toolbar buttor for the action later

Popfile configuration
Go to, and make sure the X-POPFile-Link Header option is turned ON.
Your popfile URL might be different.

You will be able to reclass messages that were received with the above option turned ON.

How can I use Claws Mail with SpamAssassin?

To train spamassassin in Claws Mail (>=1.9.6):
Menu > Configuration > Actions
In 'Menu Name' add "Mark as Spam"
In 'Command line' add -sa-learn --spam %F-
click the Add button
Menu > Configuration > Actions
In 'Menu Name' add "Mark as Ham"
In 'Command line' add -sa-learn --ham %F-
click the Add button
then select a message, Menu Tools > Actions will have the new actions to mark your email as Spam/Ham. Once you click one of the buttons spamassassin will process your request - this takes time so be patient and dont click on the 'cancel' button.

If you want to have the mail learned on a remote mail server, that's possible with a 'Command line' like this:
ssh host.domain sa-learn --ham < %f
It works best if you have already setup ssh to use keys for authentication.

How can I use Claws Mail with Mozilla? (not Firefox)

Go to Menu > Configuration > Preferences > Message View > External Programs

and write

mozilla -remote "openurl(%s,new-window)"

into the "Web Browser" field.