[Users] Suitability of using Claws instead of KMail ?

Renaud OLGIATI (Ron) renaud at olgiati-in-paraguay.org
Mon Apr 24 13:58:44 CEST 2017


On Mon, 24 Apr 2017 16:40:25 +1000
Peter <peter777 at users.sourceforge.net> wrote:

> Using Mail on Kubuntu 16.04.1 and there are LOTS of problems. Has anyone on 
> this list changed over from KMail please ?  I have looked here and there 
> regards docs about this, but doesn't seem comprehensive. Or I looked in the 
> wrong places, .. lol

Reposting what I sent to various lists in 2012 (KDE, Claws-mail, Mageia)
 
Cheers,
 
Ron.
-- 
             Luck, that's when preparation and opportunity meet.
                                                 -- P.E. Trudeau
                                    
                   -- http://www.olgiati-in-paraguay.org --


 

                           Migrating from KMAil-1 (with mbox) to Claws-Mail

Having got fed up with KDE as the years went by and KDE became more and more bloatware, I have finally decided to bite the bullet because Mageia-1 has reached its end of life, and upgrading to Mageia-2 (or 3) entails moving to Kmail-2, of which I had heard less-than-shining reports; so the time has come now to migrate to Claws Mail, get rid of KDE and move to a lighter Desktop Environment in the new release of Mageia. This is how I have done it. 

First open Kmail, "un-tree" any folder that is inside another folder, and bring them up to the "Local folders" level. Then compact all folders (or deleted mails will re-appear).

Open addressbook, and export as a LDIF file.

Create a temporary directory (~/toto) and use Valentin Koch's mbox2mh script to migrate all your mbox mail folders from /.kde4/share/apps/kmail/mail to mh folders in ~/toto. This is to avoid any unpleasantness if any of your Kmail folders have the same name as a CM folder. Then move all those folders from ~/toto to your CM directory, changing names if needed.

Open CM, right-click on the top item of the folders list "mailmh (MH)" and click "Check for new folders"; wait while _all_ your mails are gone through; then right-click on each folder in turn, and click "Mark all as read" (all your mails were read, no ?).

Go to Tools => Addressbook, then Tools => Import LDIF file to add the content of your Kmail addressbook to the CM addressbook.

If you had but a few filter rules, re-create them with the GUI; if you had a mort of them, see below.

Good luck.




                          Migrating mail filtering rules from KMAil to Claws-Mail

Getting fed up with KDE as the years go by and KDE becomes more and more 
bloatware, I finally decided to bite the bullet,  to get rid of KDE and move 
to a lighter Desktop Environment; the only thing keeping me in KDE was KMail, 
with over 125 filtering rules I did not relish entering one by one using the 
Claws-MailGUI.

So I looked into how could I speed up the process by working directly on the 
config files.

In KMail, the filter rules are part of ~/.kde4/share/config/kmailrc where each 
rule is in a paragraph beginning with [FilterN] with N the ID number of the 
rule. In Claws-Mail, they are in ~/.claws-mail/matcherrc, where each rule 
occupys one line.

Since about 95% of my rules were based on whether a given string was present 
in either the Subject header, the From header or the whole message, and simply 
moved the message to a given folder, I have decided to concentrate on those, 
and do with the GUI the few remaining and more complicated rules.

For the rules based on the presence of a string, in KMail each rule has lines 
for name= (the name of the rule), one or several filedA, fieldB etc lines for 
Subject, Message, From etc, the same number of contentsA, contentsB etc lines 
for the strings, an action-args line for the name of the folder, and an 
action-name=transfer indicating what the rule does; dead simple.

In Claws-Mail, each rule line starts with 'enabled rulename "Name Of The 
Rule"' indicating the rule is active, and called 'Name Of The Rule', then one 
or several 'subject matchcase "string1"', 'from matchcase "string2"' or 
'message matchcase "string3"' that indicate which header to filter on with 
what string, those being separated by '|' if any condition is sufficient for 
the rule, and '&' if all conditions must be fulfilled.

So I started by making a dummy rule file with the gui, which I then edited 
using Kwrite; it holds the building blocks I will use for cutting and pasting 
the rules together, with the addition of strings I will cut and paste from 
kmailrc :

	[preglobal]

	[postglobal]

	[filtering]

	enabled rulename "" subject matchcase "" move "#mh/mailmh/" 
	enabled rulename "" from matchcase "" move "#mh/mailmh/" 
	enabled rulename "" message matchcase "" move "#mh/mailmh/" 
	| subject matchcase "" 
	| from matchcase "" 
	| message matchcase "" 

Mode d'Emploi :

Start building your rule with one of the three 'enabled rulename....' 
segments, depending on whether the first condition of your rule is on Subject, 
>From or Message. If your rule is on Message Body, Any Header etc adjust to   
suit.
Add | subject..., | from.... and | message...  segments to match all the 
FieldA, FieldB, etc in the Kmail rule, to build the skeleton of the rule.
Copy and paste the name, contentsA, B etc. and action-arg strings from kmailrc 
in their places between the "" in your rule skeleton.
And Presto, your rule is done. If your rule depends on all conditions being 
fulfilled together, replace all the '|' of the rule with '&'. If you want your 
rule to be case-sensitive, use 'match' instead of 'matchcase'.

While a rule in KMail is limited to eight conditions, there does not seem to 
be any such limitation in Claws-Mail, which means that if you were compelled 
in KMail to split a rule in several rules doing the same action, you can bring 
them all together in Claws-Mail.

To check for mis-pasted or forgotten strings, search your file for the strings 
'""' and 'mailmh/"'.

Once you have finished editing matcherrc, you will have to restart Claws-Mail 
for the new filter rules to be taken into account.

enabled rulename "test1" subject matchcase "Test2" move "#mh/mailmh/trash" 
mark_as_read
enabled rulename "test2" from matchcase "olgiati" & subject matchcase "test" & 
subject match "Case Sensitive" & from regexpcase "ABC*"
 & headers_part matchcase "headers" & body_part matchcase "body" & message 
matchcase "whole message" delete


A quick syntax and vocabulary :

enabled | disabled : whether the rule is active or not.

rulename "string" : the identifier of the rule.

[ from | subject | message | body_part | headers_part ] [match | matchcase | 
regexpcase ] "string" Where to look for the string, and how (case sensitive, 
insensitive, regular expression) A tilde ~ at the beginning implies a 
negation.of the condition. | means OR, & means AND and the two should not 
AFAIK be mixed in a rule.

[move "#mh/mailmh/string" | delete] : move message to the mail folder string, 
or delete it.
 



More information about the Users mailing list