Introduction
The "actions" feature is a convenient way for the user to
launch external commands to process a complete message
file including headers and body or just one of its parts.
It allows also the use of an external command to filter
the whole text or just a selected part in the message
window or in the compose window. This is a generic tool
that allows to do any uncommon actions on the messages,
and thus extends the possibilities of Sylpheed. For
example, Sylpheed does not include the rot13 cyphering
algorithm popular in some newsgroups. It does not support
natively armored encryption or clear signing. It does not
support uuencoded messages. As all these features can be
handled by external programs, the actions provide a
convenient way to use them from the menu bar.
The "actions" feature is integrated in Sylpheed-Claws. A
back-port to Sylpheed-Main is available in this page, here.
Usage To create a new action,
go to Configuration ->
Actions.... The "Actions setting" dialog offers to
enter the Menu name that will trigger the
command. The created menu will be found in the Tools ->
Actions submenu. By inserting a slash / in
the menu name, you create a submenu.
The command is entered in the Command line
entry. Note that Sylpheed stores every single email in a
separate file. This allows to use the following syntax
for the command:
- %f denotes the file name of the selected
message. If you selected more than one, then the
command will be launched for each message with the
appropriate file name;
- %F denotes the list of the file names of
the selected message. If only one message is selected,
this amounts to %f, but if more messages are
selected, then the command will be launched only once
with the list of the file names. (You can use both
%f and %F in one command: then the
command will be launched for each selected message
with the name of this message and with the list of all
selected messages. I did not find a practical example
for this.);
- %p denotes the current selected message
part of a multipart message. The part is decoded
accordingly.
If the message is not a multipart message, it denotes
the message body;
- Prepending >: this will allow you to send
to the command's standard input a text that you will
enter in a dialog window;
- Prepending *: this will allow you to send
to the command's standard input a text that you will
enter in a dialog window. But in contrast to
prepending >, the entered text is hidden
(useful when entering passwords);
- Appending an ampersand &: this will
run the command asynchronously. That means "fire and
forget". Sylpheed won't wait for the command to
finish, nor will it catch its output or its error
messages;
- Prepending the vertical bar | (pipe-in):
this will
send the current displayed text or the current
selected text from the message view or the compose
window to the command standard input. The command will
silently fail if more than one message is
selected;
- Appending the vertical bar | (pipe-out):
this will replace the current displayed text or the
current selected text from the message window or the
compose window with the command standard output. The
command will silently fail if more than one message is
selected.
- Appending the "greater than" sign > will
insert the command output in the message. The
difference between the trailing | is that no
text will be deleted or replaced. Most used when
composing mails to insert text. Only available
since 0.8.6claws66
Note: It is not possible to use actions
containing %f, %F or %p from the
compose window.
When a command is run, and unless it is run
asynchronously, Sylpheed will be insensitive to any
interaction and it will wait for the command to
finish. If the command takes too long (5 seconds), it
will popup a dialog window allowing to stop it. This
dialog will also be displayed as soon as the command has
some output: error messages or even its standard output
when the command is not a "pipe-out" command. When
multiple commands are being run, they are run in
parallel and each command output is separated from the
outputs of the others.
Examples
Here are some examples that are listed in the same syntax
as used for storing the actions list. You can copy and
past the definition in your ~/.sylpheed/actionsrc
file (exit Sylpheed before). The syntax is very simple:
one line per action, each action contains the menu name
and the command line separated by a colon and a space ":
". Alternatively, you can use Configuration ->
Actions... and for each example enter a menu name and
copy&paste the text after the colon and space ": " in the
command definition.
Purpose
| Definition | Details |
rot13 cyphering
|
Rot13: |tr a-zA-Z n-za-mN-ZA-M| |
This will apply the rot13 cyphering algorithm to
the (selected) text in the message/compose
view. |
Decoding uuencoded messages
|
UUdeview: xdeview %F&
| xdeview comes with uudeview. If an encoded
file
is split in multiple messages, just select them
all and run the command.
|
Display uuencoded image | Display uuencoded:
uudec %f& |
Displays uuencoded files. The uudec script is
to be found here. |
Save MS TNEF parts |
|
Select the TNEF message part then use this action to extract the attachment. |
Alter messages
| Edit message: gvim -f
%F | Allows to edit any received
message. Can be
used to remove unneeded message parts etc. |
Pretty format | Par:
|par 72Tbgjqw74bEe B=._A_a 72bgi| |
par is a utility that can pretty format any
text. It does a very good job in indenting quoted
messages, and justify text. Used when composing a
message |
Browse | Part/Dillo:
dillo %p& | Browse the selected
message part in Dillo. |
Clear Sign | |
Clear sign a message. The gpg-sign-syl script is
responsible for asking the passphrase and for
running gnupg. Make sure that you wrap your
message correctly before signing, and that the
resultant text will not be wrapped when sent (by
disabling 'wrap on send') |
Verify Clear Signed | GnuPG/Verify: |gpg --no-tty
--verify |
Verify clear signed messages. The result is
displayed in the actions output dialog. |
Encrypt ASCII Armored |
|
Encrypt message to ASCII armored. The
recipient will be asked in a xterm. |
Decrypt ASCII Armored | GnuPG/Decrypt: *gpg --no-tty
--command-fd 0 --passphrase-fd 0 --decrypt
%p| |
Decrypt ASCII armored messages. The passphrase
is to be entered in the opened action's input
dialog. |
Receive key from server |
GnuPG/Receive Selected Key: |gpg --recv-key `cat` |
Select a key ID in the message view then call this action to import it from a key server. GnuPG option file must contain a reference to a keyserver. (Suggested by Bob Forsman) |
Import key from mail |
GnuPG/Import Key From Mail: gpg --import %p |
Select the message part where the public key is then import it with this action. |
Insert public key in message |
GnuPG/Insert My Public Key: gpg --export -a MYKEYID> |
Insert your public key in the message your are composing. Replace MYKEYID with your key id. Needs 0.8.6claws66 or newer. |
Reporting SPAM | Report
as SPAM: spamassassin -r <
%f |
Use spamassassin
to report mail as spam. Redirection (<) is
possible only with version 0.7.7. |
Check spelling | Check
spelling: |T=`mktemp
$HOME/.sXXXXXX`; cat - > $T;xterm -e ispell
$T;cat $T;rm $T| |
Open a terminal and check the spelling with
ispell |
Google for message id |
| Search the web for the selected message
ID. Needs the
google_msgid.pl
script. |
The gpg-enc-syl script is
to be found here
(gpg-enc-syl). It calls gpg with the --yes command
line option that you may want to remove. See gpg manual
page for mor info.
The gpg-sign-syl
script is
to be found here (gpg-sign-syl). It
needs the ssh-askpass utility found in OpenSSH. It can
be replaced by any X11 tool that asks some (hidden) text
which is then sent to standard output. Another version
that uses an xterm is to be found
here
(gpg-sign-syl-xterm).
The uudec script is to be
found here (uudec). It needs
uudecode and ImageMagick's display. The
latter can be replaced by any image viewer that can get
input from standard input. The script could also be
modified to use temporary files instead of standard
input.
The google_msgid.pl
script is to be found here
(google_msgid.pl). Example and script by Thorsten
Maerz. Edit the script to change the browser (default is
mozilla).
The tnef-claws bash script was written by Shawn Lamson and is to be found here. The script is well commented. You need to have the tnef package already installed.
Win32 Examples
Actions could be implemented in the Win32 port of
Sylpheed-Claws thanks to Thorsten Maerz. Because of
platform restrictions, the examples above cannot be run as
listed. You can find their equivalents for the Win32
version at Sylpheed-Claws/Win32 Actions page
Back-Port to Sylpheed
0.7.8cvs17 The Actions feature was merged into
version 0.7.8cvs17 of Sylpheed, thus newer Sylpheed
releases include it and there is no need to patch
anymore. Thanks to Hiro and to the Claws crew.
0.7.7 This version adds the possibility to use
redirection, multiple piping and multiple commands in the
actions definition. A fictitious command could be:
|foo|bar;toto < %f;echo OK.
The back-port to Sylpheed 0.7.7 is to be found here
(sylpheed-0.7.7.actions.patch.gz). From within
Sylpheed's source directory apply with gzip -dc
sylpheed-0.7.7.actions.patch.gz|patch -p0. Then
configure, build and install as usual.
0.7.6 The back-port to Sylpheed 0.7.6 is to be
found here
(sylpheed-0.7.6.actions.patch.gz). From within
Sylpheed's source directory apply with gzip -dc
sylpheed-0.7.6.actions.patch.gz|patch -p1. Then
configure, build and install as usual.
0.7.4 The back-port to Sylpheed 0.7.4 is to be
found here
(sylpheed-0.7.4.actions.patch.gz). From within
Sylpheed's source directory apply with gzip -dc
sylpheed-0.7.4.actions.patch.gz|patch -p0. Then run
./autogen.sh and configure, build and install as
usual.
|