Learn how Claws Mail's Actions tool extends the cross-platform email client's feature set. Jack Wallen provides sample external commands to help you get started with Actions.
Claws Mail is one of the most powerful email clients available. There are so many features and tweaks with the software that you could spend hours discovering new methods to make Claws Mail do things other email clients cannot.
The Claws Mail advanced tool Actions is a way for the user to easily launch external commands to process a complete message file (including headers and body), as well as filter part of or the entire text in the message window or the compose window.
These are some of the things you can do with Actions:
- Apply cyphering algorithms
- Display uuencoded files
- Open uuencoded files with an external program (such as LibreOffice)
- Save attachments from multiple emails
- Save MSTNEF parts of messages
- Edit messages
- "Pretty" format text
- Browse the selected message text
- Receive GPG keys
- Display encryption keys within message
- Spell check
- Search Google for selected text
Claws Mail is available with a simple installer for Linux and Windows. For Mac, you need to follow these steps for building it.
Creating and configuring an action
It's simple to create an action, as long as you understand the necessary switches. These switches and fields are used in conjunction with the commands:
- %f - denotes the file name of the selected message.
- %F - denotes the list of the file names of the selected message.
- %p - denotes the current selected message part of a multi-part message.
Every external command will have its own built-in switches. You must fully understand the command structure before you can use an external command for an Action. Since so many external commands can be used, I am offering several examples to get you started.
Let's say a lot of users are sending emails with their GPG keys attached. Instead of saving the key and importing the key from the command line, you could create an action that will allow you to right-click the email and select an action. Here's how to create this action.
To start the process, you need to know the command you want to use. For our first action, we will import a GPG key; for this to work, GnuPG must be installed. The command we will use for this action is gpg —import %p. The —import switch is from the gpg command and tells gpg to import the key (which is defined using the %p field). This is where you add the action:
- Open Claws Mail.
- Click Configuration | Actions.
- In the new window, enter the information for the action (Figure A):
- Menu Name: The name that will appear in the Actions menu.
- Command: The command used for the Action.
- Shell Command: If this is a command, select this option.
- Filter Action: If this Action is for filtering, select this option.
- Click the Add button.
- Click the OK button.
For more information about fields, click the Information button. Also, you can also move your actions up and down the Current Actions list so the ones you use most are at the top.When you create an action, it will appear in the Tools | Actions view (Figure B). If you select an email and then click your new action, the action will take place (in this case, the importing of the gpg key). Figure B
Our GPG import action listed.
Now that you know how to create the actions, here are more samples you can use.Report spam: If you have SpamAssassin installed, you can report an email is spam by adding this command as an action:
spamassassin -r < %fSearch Google: Highlight a section of text in the email and then search Google for the string. For this to work, download the google_search.pl file and place it in /usr/local/bin/.
google_search.plSave Attachments: You can select one or more emails and save any or all of the attachments into your home folder. This action requires the mpack package.
munpack -C ~ — %F
Creating Filter Actions
Follow these steps to create Filter Actions:
- Go to Configuration | Actions and give the filter a name.
- Select Filter Action.
- Click the Edit Filter Action.
- In the new window, enter the necessary information (Figure C).
- Click the Add button and then click the OK button.
Depending upon the Action selected, the Destination section will differ.
You can create these types of Filter Actions:
- Message Flags
- Color Label
- Add to Address Book
- Stop Filter
Give Claws Mail Actions a try — I bet you'll be astonished by how much you can do with the email client's powerful tool.