Difference between revisions of "Filtering and Processing of Messages"

From Claws Mail FAQ
Jump to: navigation, search
m (Reverted edit of Worthlessomen39, changed back to last version by Shlomif)
 
Line 1: Line 1:
So something about your body has been bothering you for years, and you're now on the fence as to irrespective of whether you want to do something about it. Take the time to read the following feature to get a number of concepts concerning the do's & don'ts about cosmetic surgery.
+
<div id=age>
 +
=== What type of value do the "age ..." match types in the filtering configuration expect? ===
  
In case you are looking into having cosmetic surgery be sure that you are completely aware of the recovery process. Depending on the kind of surgery you have, you might be checking out an extremely long recovery time or potentially irritating effects as you recover. The critical thing is that you know what could occur so that you can plan ahead for it.
+
You simply have to add the value in days. If you want for example to select messages older than a month, enter 30 or 31.
  
In the event you would like to have plastic surgery done but are worried concerning the cost, consider a payment plan. A payment plan makes it possible for a consumer to split the expense over a variety of months, or even years, usually with a low interest rate attached. This is provided in many surgeon's offices, and it is less pricey than working with a credit card.
+
Example of a folder processing rule of the "mailbox/claws-mail/" Folder, that move messages older that 60 days to an archive folder:
 +
<pre>
 +
age_greater 60 move "#mh/mailbox/claws-mail/archive"
 +
</pre>
  
While you could be a fantastic parent and have a few well-behaved children. You might want to see if a relative can watch, then for a number of days after surgery. It will be hard for you to cook for them & take care of them while you are attempting to recover.
+
'''Note:''' Age checks are done against the 'Date'-header in the mail. So if the sender has misconfigured his computer and sends mails with a wrong date, the rule could move mails instantly if the date is more then 60 days in the past or never when it is in the future.
 +
</div>
 +
=== Can I filter messages based on Content-Type of attachments, for example "application/x-msdownload"? ===
  
There are risks that come with undergoing cosmetic surgery as there are with other sorts of surgery. These risks incorporate sedation complications, blood loss, aspiration, blood clots, infection, sutures coming loose & incorrect healing. Before you undergo any cosmetic procedures, make sure that you fully realize all the risks related with it.
+
Yes. Select Match Type 'Body part' and enter the Value <code>Content-Type: application/x-msdownload</code>.
  
While coffee is a less harmful substance than plenty of others, it should be avoided quickly before the procedure & particularly during recovery. Caffeine is a stimulant which restricts the size of your veins and arteries and once you are talking about skin recovery, this really is something that you want to stay away from.
+
Please note that application/octet-stream is also a potential infected content (.pif for instance).
 +
You can also use a more generic case-insensitive regexp matching rule against the 'Body part' like the following one:<br>
 +
<pre>
 +
Content\-Type: ~[[a-z0-9_/-]]+; name="~[[^\.]]+\.(bat|pif|cmd|vbs|vba|scr|lnk|com|exe|java|asp|cgi)"
 +
</pre>
  
Be sure that the surgeon you selected is certified by the American Society of Plastic Surgeons. If they are not, you will need to contemplate going to see some other person. You will need to also request before & after pictures of patients.
+
'''Note:''' This will also match text inside the message and not only the Content-Type, so be aware of messages discussing the structure of MIME-Mails.
  
Plan so that your life is not overly demanding for the two weeks right away after your surgery. Once you contemplate cosmetic surgery, it isn't as easy as taking a day off, and then going right back to work. Factor in recovery time. Also as having an individual accessible to allow you if, you want help for a number of days.
+
=== What is the difference between Filtering, Folder Processing, Pre/Post-processing? ===
  
Seek out a board certified surgeon. These surgeons commonly have further prices, but they have been approved by the American Board of Plastic Surgeon & have more than likely received an extensive tuition to qualify. A board certified surgeon will need to be better prepared, nevertheless remember that experience is also an crucial factor.
+
Filtering rules are global. Messages received on an Account can be filtered in 2 ways, automatically or manually. To have the messages filtered automatically the option 'Filter messages on receiving' must be checked on the 'Receive' tab in the Account Preferences. Manual filtering can be performed by using '/Tools/Filter all messages in folder' or '/Tools/Filter selected messages'.
  
Hopefully the document has shed many light as far as cosmetic surgery is involved. Ensure to keep this info in mind when attempting to decide if cosmetic surgery is right for you. The more you realize concerning the process, the more confident you'll feel about the choice you will make.
+
Folder Processing rules apply only to the messages contained in that particular folder. A folder's Processing rules are applied upon entering that folder, or on program startup if 'Process at startup' is checked in a folder's Properties, or on demand by using 'Run processing rules' from the folder's context menu.
  
Paul Wilson Plastic Surgery
+
Pre and post-processing rules are global rules which are executed before and after the folder processing rules, respectively.
Suite 4623
+
In other words: Whenever you select a folder, first pre-processing rules are applied, then folder specific processing rules and lastly post-processing rules. See [[Filtering_and_Processing_of_Messages#age|'age'-question]] for an example.
The Spire Hospital
+
Durdham Down
+
Bristol
+
BS6 6UT
+
United Kingdom
+
  
0117 910 2401 http://www.paulwilsoncosmetic.co.uk
+
=== Can a filter modify the contents of a message? ===
 +
 
 +
None of the built-in filters modify the contents of a message, but you can use the 'test' filter to run a command that can modify the contents of a message. See the next question for an example.
 +
 
 +
=== How do I configure a filter for running SpamAssassin? ===
 +
 
 +
If you want to use SpamAssassin directly, instead of using the plugin, you can get the SpamAssassin headers added to each message, and/or tag the subject line of spam messages. First, you have to set up SpamAssassin correctly, which is beyond the scope of this FAQ. This example uses the spamc/spamd client server model, but it could easily be adapted for calling SpamAssassin directly. First, save this script somewhere in your PATH (eg $HOME/bin/sc-spamc).
 +
<pre>
 +
#!/bin/bash
 +
#
 +
# sc-spamc : a script for using SpamAssassin header modification / subject
 +
# tagging vi Claws Mail filtering actions.
 +
#
 +
# Author: Robert Story
 +
# Send questions or comments to the claws-mail-users mailing list
 +
#
 +
# Based on a simpler script posted to the claws-mail-users mailing list
 +
# by Richard A Downing.
 +
#
 +
# Should return the return code from spamc (1=spam, 0=nospam/error)
 +
#
 +
 
 +
die()
 +
{
 +
: error "$@"
 +
: exit 0
 +
}
 +
 
 +
FILE=$*
 +
TEMP=sc-spamc.$$
 +
 
 +
#
 +
# call spamc, redirect output to temporary file, and save return value
 +
#
 +
/usr/bin/spamc -E -t 30 < "$FILE" > "$TEMP"
 +
RC=$?
 +
 
 +
#
 +
# make sure temp file exists before we replace original message
 +
#
 +
if ! test -s "$TEMP" ; then
 +
: die "spamc result file doesn't exist or is 0 bytes"
 +
fi
 +
 
 +
#
 +
# backup original
 +
#
 +
mv "$FILE" "$FILE.bak"
 +
if test $? -ne 0; then
 +
: die "'mv $@' failed!"
 +
fi
 +
 
 +
#
 +
# rename filtered file
 +
#
 +
mv "$TEMP" "$FILE"
 +
if test ! 0 = $?; then
 +
: mv "$FILE.bak" "$FILE"
 +
: die "spam result rename failed, restoring backup"
 +
else
 +
: rm "$FILE.bak"
 +
fi
 +
 
 +
#
 +
# return spamc exit code
 +
#
 +
exit $RC
 +
 
 +
</pre>
 +
Now, set up a Filtering rule (test "!(sc-spamc %F)"), with an action for dealing with spam (eg color it, move it to a folder, etc).
 +
 
 +
=== How do I add a filter for SPF checking? ===
 +
 
 +
To check if the sender IP address matches the SPF record you can download the script sylpheed-spf.pl from http://www.willamowius.de/claws-spf.html and add a filter with the following condition and move matching mails to your spam folder.
 +
 
 +
<pre>
 +
test "!(sylpheed-spf.pl -c <%F)"
 +
</pre>
 +
 
 +
=== My ISP adds headers that identify spam and viruses.  How do I filter on a custom header? ===
 +
 
 +
You can filter on a custom header.  The drop-down list of headers defaults to the commonly used headers, but you can edit the list and add new entries. Create a filter in the normal way and select "Header" as the condition. Simply start typing in the list box to edit or add a header.

Latest revision as of 10:26, 26 October 2012

Contents

What type of value do the "age ..." match types in the filtering configuration expect?

You simply have to add the value in days. If you want for example to select messages older than a month, enter 30 or 31.

Example of a folder processing rule of the "mailbox/claws-mail/" Folder, that move messages older that 60 days to an archive folder:

age_greater 60 move "#mh/mailbox/claws-mail/archive"

Note: Age checks are done against the 'Date'-header in the mail. So if the sender has misconfigured his computer and sends mails with a wrong date, the rule could move mails instantly if the date is more then 60 days in the past or never when it is in the future.

Can I filter messages based on Content-Type of attachments, for example "application/x-msdownload"?

Yes. Select Match Type 'Body part' and enter the Value Content-Type: application/x-msdownload.

Please note that application/octet-stream is also a potential infected content (.pif for instance). You can also use a more generic case-insensitive regexp matching rule against the 'Body part' like the following one:

Content\-Type: ~[[a-z0-9_/-]]+; name="~[[^\.]]+\.(bat|pif|cmd|vbs|vba|scr|lnk|com|exe|java|asp|cgi)"

Note: This will also match text inside the message and not only the Content-Type, so be aware of messages discussing the structure of MIME-Mails.

What is the difference between Filtering, Folder Processing, Pre/Post-processing?

Filtering rules are global. Messages received on an Account can be filtered in 2 ways, automatically or manually. To have the messages filtered automatically the option 'Filter messages on receiving' must be checked on the 'Receive' tab in the Account Preferences. Manual filtering can be performed by using '/Tools/Filter all messages in folder' or '/Tools/Filter selected messages'.

Folder Processing rules apply only to the messages contained in that particular folder. A folder's Processing rules are applied upon entering that folder, or on program startup if 'Process at startup' is checked in a folder's Properties, or on demand by using 'Run processing rules' from the folder's context menu.

Pre and post-processing rules are global rules which are executed before and after the folder processing rules, respectively. In other words: Whenever you select a folder, first pre-processing rules are applied, then folder specific processing rules and lastly post-processing rules. See 'age'-question for an example.

Can a filter modify the contents of a message?

None of the built-in filters modify the contents of a message, but you can use the 'test' filter to run a command that can modify the contents of a message. See the next question for an example.

How do I configure a filter for running SpamAssassin?

If you want to use SpamAssassin directly, instead of using the plugin, you can get the SpamAssassin headers added to each message, and/or tag the subject line of spam messages. First, you have to set up SpamAssassin correctly, which is beyond the scope of this FAQ. This example uses the spamc/spamd client server model, but it could easily be adapted for calling SpamAssassin directly. First, save this script somewhere in your PATH (eg $HOME/bin/sc-spamc).

#!/bin/bash
#
# sc-spamc : a script for using SpamAssassin header modification / subject
# tagging vi Claws Mail filtering actions.
#
# Author: Robert Story
# Send questions or comments to the claws-mail-users mailing list
#
# Based on a simpler script posted to the claws-mail-users mailing list
# by Richard A Downing.
#
# Should return the return code from spamc (1=spam, 0=nospam/error)
#

die()
{
: error "$@"
: exit 0
}

FILE=$*
TEMP=sc-spamc.$$

#
# call spamc, redirect output to temporary file, and save return value
#
/usr/bin/spamc -E -t 30 < "$FILE" > "$TEMP"
RC=$?

#
# make sure temp file exists before we replace original message
#
if ! test -s "$TEMP" ; then
: die "spamc result file doesn't exist or is 0 bytes"
fi

#
# backup original
#
mv "$FILE" "$FILE.bak"
if test $? -ne 0; then
: die "'mv $@' failed!"
fi

#
# rename filtered file
#
mv "$TEMP" "$FILE"
if test ! 0 = $?; then
: mv "$FILE.bak" "$FILE"
: die "spam result rename failed, restoring backup"
else
: rm "$FILE.bak"
fi

#
# return spamc exit code
#
exit $RC

Now, set up a Filtering rule (test "!(sc-spamc %F)"), with an action for dealing with spam (eg color it, move it to a folder, etc).

How do I add a filter for SPF checking?

To check if the sender IP address matches the SPF record you can download the script sylpheed-spf.pl from http://www.willamowius.de/claws-spf.html and add a filter with the following condition and move matching mails to your spam folder.

test "!(sylpheed-spf.pl -c <%F)"

My ISP adds headers that identify spam and viruses. How do I filter on a custom header?

You can filter on a custom header. The drop-down list of headers defaults to the commonly used headers, but you can edit the list and add new entries. Create a filter in the normal way and select "Header" as the condition. Simply start typing in the list box to edit or add a header.