# Advanced features

## Actions

Actions allow you to use all the power of the Unix command-line with your emails. You can define various commands, taking parameters such as the current email file, a list of emails, the currently selected text, and so on. In this way, you'll be able to perform various tasks such as editing a raw mail in your text editor, hide what you mean using ROT-13, apply patches contained in emails directly, and so on. The only limit is your imagination. You can create and configure Actions via the /Configuration/Actions... menu.

The Tools/Actions/ menu will contain one submenu item for each action that you have created. When you have selected one or more messages in the Message List, or are viewing a message in the Message View, selecting one of these menu items will invoke the action, and, depending on how it was defined, will pass the message(s) to it.

Additionally, it is possible to add toolbar entries for your actions. To do so, open the Configuration/Preferences menu and select Toolbars/Main Window. Select User Action in the Item type dropdown menu, then select the Action in the Event executed on click dropdown menu, and click the Icon button to select the icon that you want to use.

> ### Simple Open With...

> Menu name: Open with/kate Command Line: `kate %p`

>   Opens the file of the selected decoded MIME part (%p) with the kate text editor.

> ### Spam management using Bogofilter

> Menu name: Bogofilter/Mark as Ham Command Line: `bogofilter -n -v -B "%f"`

>   Marks the currently selected mails (%f) as not spam using Bogofilter.

> Menu name: Bogofilter/Mark as Spam Command Line: `bogofilter -s -v -B "%f"`

>   Marks the currently selected mails (%f) as spam using Bogofilter.

> ### Search DuckDuckGo using an external script

> Menu name: Search/DuckDuckGo Command Line: `|/path/to/ddg_search.pl`

>   Searches DuckDuckGo for the currently selected text (|) using the external script ddg_search.pl.

## Templates

Templates are used in composition windows, and act as a model for emails. Templates can be filled with static text and dynamic parts, such as the original sender's name (Dear %N, ...), the date, etc. When applying a template, the dynamic fields will be replaced with the relevant values. You can configure templates via the Tools menu.

When applying a template, you will be asked to Insert or Replace, the difference between replacing and inserting is only concerned with the message body. Replace will replace the current composition window message body with the body defined in the template, clearing it if the template body is empty. Insert will insert the template's body, if set, at the current cursor position.

Whether you choose to Insert or Replace, any To, Cc or Bcc field that is defined in the template will be appended to the compose window's recipients list. If it is defined, the template's Subject will always replace the compose window's Subject.

Symbols can be used in all parts of the templates and will be substituted with their respective dynamic value if possible, otherwise no value will be used. This often makes more sense if you apply a template when replying or forwarding, otherwise most of the symbols value will be undefined. There is no restriction on which symbols can be used in template parts, even if inserting the body (%M or %Q) may make no sense in common situations.

When applying a template, the body is processed first, then the To, Cc, Bcc and Subject fields follow.

Further information and examples of usage can be found in the user-contributed FAQ on the Claws Mail website www.claws-mail.org/faq/.

## Processing

Processing rules are the same as Filtering rules, except that they are applied when entering a folder or when manually applied from a folder's context menu and apply only to this folder. You can use them to automatically move old mails into an archive folder, or for further dispatching of emails, and more. You can set each folder's Processing rules by right-clicking on it.

Processing rules are accompanied by Pre-processing and Post-processing rules. Like Processing rules, they apply when opening a folder or manually applying them from a folder's context menu, but like Filtering rules, they are shared across all folders. You can configure them from the Tools menu. Pre-processing rules are executed before the folder's specific Processing rules, while Post-processing rules are executed afterwards.

## Colour Labels

Colour labels can be used to denote a message as having a particular significance. To set a colour label simply right-click a message in the Message List and use the Color label submenu.

Colour labels are user-configurable. Both the colour and the label can be set by the user. Preferences can be found on the Configuration/Preferences/Display/Colors page.

## Tags

Tags are short text notes which may be set on messages. They are useful for classifying messages with your own words. These tags can be used later to find the mails with Quick Search or to manage them with filtering or processing rules, for example.

Tagged messages are displayed with a yellow background at the top of the Message View. This line shows all tags associated with the message. You can enable the "Tags" column in the Message List, so tagged items can be seen without having to open the message.

Setting of tags is done by right-clicking on the message in the Message List or by the corresponding option in Message menu. A panel with the existing tags is shown and you can select some of them or just add a new one. Removal of existing tags is also allowed, of course.

Once tags exist it's even easier, as the context menu allows you to set and unset tags with just one click to the selected messages. Mixed selections of tagged and untagged messages are allowed, and Claws Mail is clever enough to do what you want to do in any case.

## Mailing-List support

Claws Mail offers mailing-list support from the Message/Mailing-List/ submenu. When you have a mailing-list message selected, the submenu allows you to quickly initiate subscribing, unsubscribing, posting, getting help, contacting the list owner, and viewing the list archive; either by opening a new Compose window with the appropriate address pre-filled, or by opening the URL in your web browser.

## Plugins

Plugins are the mechanism for extending Claws Mail' capabilities. For example, imagine that you want to store your mails in a remote SQL database. In most mailers out there this is simply impossible without reworking the internals of the mailer. With Claws Mail you can simply write a plugin to achieve the task.

This is just an example of the possibilities. A good number of plugins developed for Claws Mail already exist, and more are to come. The Extending Claws Mail section gives details of them.

## Deploying Claws Mail

The initial configuration wizard tries to guess various fields using information gathered from the system, such as username, hostname, and more. As it is oriented towards general use, the default values often have to be fixed. However, this wizard is customisable, in a manner designed to allow system administrators to deploy Claws Mail easily over various users of one machine, or even over multiple machines installed via some replication tool.

The first part consists of creating a wizard configuration template and setting the various default parameters of a new Claws Mail installation.

- Start with a user who does not have a `~/.claws-mail` directory, ideally a new user.

- Start Claws Mail and go through the wizard. The values you fill in will be of no use for the future deployment, so you can click next-next-next.

- Once the wizard is finished and you have Claws Mail' main window opened, configure the various defaults you want to have in the master. You can load plugins, add people or LDAP servers in the addressbook, create filtering rules, and so on.

- If needed, and if the deployed Claws Mail will use MH folders, you can create subdirectories in the mailbox.

- Next, quit Claws Mail.

- Now, edit the newly created wizard template file, `~/.claws-mail/accountrc.tmpl`. In this file, you will see different variables, corresponding to the wizard's fields. You can leave some commented, in which case the usual default will be used, or specify values or variables. Not all fields can contain variables; for example, `smtpauth`, `smtpssl` and `recvssl` are booleans, either 0 or 1, and `recvtype` is an integer value. The other fields, like `name`, `email`, or `recvuser`, are parsed by the wizard and the variables they contain are replaced by values. This allows you to specify everything as needed for your site, even if you have strange server names or server logins.

- Save this file, and delete both `~/.claws-mail/accountrc`, (which contains your dummy account) and `~/.claws-mail/folderlist.xml`, (so that the folder tree will be correctly parsed for new users). Recursively copy `.claws-mail` to `/etc/skel/`; if the deployed Claws Mail will use MH folders, also copy the created `Mail` directory. chown all of `/etc/skel/.claws-mail` and `/etc/skel/Mail` to `root:root` for security reasons.

- Test! Create a new user, login as that user, run Claws Mail. If you filled everything as you wanted, this user will just have to fill in his passwords.

- Now, if you're creating a master for a site-wide deployment, you can continue with this process. If you were just doing it for one machine, you're done!

Here are the different variables of the `accountrc.tmpl` file:

`domain`

  Your domain name (example.com). If not set, it'll be extracted from the hostname.

`name`

  The user's name. If not set, it'll be extracted from Unix login information, which is usually ok.

`email`

  The user's email. If not set, it'll be extracted from `$name` and `$domain`.

`organization`

  Your organization. If not set, it'll be empty.

`smtpserver`

  The SMTP server to use. If not set, it'll be `smtp.$domain`.

`smtpauth`

  0 or 1. Whether to authenticate on the SMTP server. If not set, it'll be 0.

`smtpuser`

  The login on the SMTP server. If not set, it'll be empty (same login as for reception will be used).

`smtppass`

  The password on the SMTP server. If not set, it'll be empty (if `smtppass` is empty but `smtpuser` is not, the user will be asked for the password).

`recvtype`

  The type of server to receive from. 0 for POP3, 3 for IMAP4, 5 for a local MBOX file. If not set, it'll be 0 (POP3).

`recvserver`

  The reception server. If not set, it'll be `(pop|imap).$domain`, depending on `$recvtype`.

`recvuser`

  The login on the reception server. If not set, it'll be extracted from the Unix login information.

`recvpass`

  The password on the reception server. If not set, it'll be empty (the user will be asked for it once per session).

`imapdir`

  The IMAP subdirectory. If not set, it'll be empty, which is often sufficient.

`mboxfile`

  The MBOX file to receive from if `$recvtype` is 5. If not set, `/var/mail/$LOGIN`.

`mailbox`

  The MH mailbox to store mail in (for `$recvtype` 0 or 5). If not set, it'll be Mail.

`smtpssl`

  0 or 1. Whether to use SSL for sending mail. If not set, it'll be 0.

`recvssl`

  0 or 1. Whether to use SSL for receiving mail. If not set, it'll be 0.

Here are the different variables you can use in the `domain`, `name`, `email`, `organization`, `smtpserver`, `smtpuser`, `smtppass`, `recvserver`, `recvuser`, `recvpass`, `imapdir`, `mboxfile` and `mailbox` fields:

`$DEFAULTDOMAIN`

  The domain name as extracted from Unix hostname information. Often wrong.

`$DOMAIN`

  The domain name as set in the domain variable, the first of the template file.

`$USERNAME`

  The user's real name.

`$LOGIN`

  The user's Unix login.

`$NAME_MAIL`

  The user's real name as set in the name variable of the template field, in lowercase and with spaces replaced by dots. Colin Leroy becomes colin.leroy.

`$EMAIL`

  The email address as set in the email variable of the template field.

Be sure not to use a variable before defining it.

## Hidden preferences

There are a number of hidden preferences in Claws Mail, preferences that some users who we wanted to please couldn't live without, but which did not have a place in the GUI in our opinion. You can find the following, and change them while Claws Mail is not running, in `~/.claws-mail/clawsrc`.

There's a small tool written in Perl-GTK called Clawsker which provides a user-friendly GUI for tweaking these settings instead of direct editing of `clawsrc`. You can read more about it on the Clawsker page.

`address_search_wildcard`

  TAB-address completion in the Compose window and other GUI places will match any part of the string ('1') or just the start of the string ('0'). Default value is '1'.

`addressbook_use_editaddress_dialog`

  Use a separate dialogue to edit a person's details if set to '1' (default). '0' will use a form embedded in the addressbook's main window.

`bold_marked`

  Show marked messages in the message list of summary view using a bold font when set to '1'. '0' (default) will use normal font.

`bold_unread`

  Show unread messages in the message list of summary view using a bold font when set to '1' (default). '0' will use normal font.

`cache_max_mem_usage`

  The maximum amount of memory to use to cache messages, in kB. It will try to keep the memory usage below this value, but it will always use the assigned amount of memory for speed gain. Default value is '4096'.

`cache_min_keep_time`

  The minimum time in minutes to keep a folder cache in memory. Caches more recent than this time will not be freed, even if the memory usage is too high. You should probably set this value higher than your mail check interval. Otherwise the cache will always be freed between checks even if the folder is accessed on every check, which will cause much disk I/O. Default value is '15'.

`compose_no_markup`

  Don't use bold and italic text in Compose dialogue's account selector if set to '1'. Default value is '0' (use markup).

`default_header_color`
`default_header_bgcolor`

  Foreground and background colors to use for the Compose window's header entry values. Default values are '#000000' (black) and '#f5f6be' (pale yellow), respectively.

`emphasis_color`

  The colour used for the X-Mailer line in Message View when its value is Claws Mail. Default value is '#0000CF' (medium blue).

`enable_avatars`

  Enables capture and/or rendering of internal avatars (Face and also X-Face headers if built with compface support). '0' disables both, '1' enables capture only, '2' enables rendering only and '3' enables both. Default value is '3'.

  Note that external plugins already providing these features may disable partially or completely this to speed up process, regardless of the configured value.

`enable_hscrollbar`

  Enable the horizontal scrollbar in the message list of Summary View if set to '1' (default). Set it to '0' to disable.

`enable_swap_from`

  Display the recipient's email address (preceded by an arrow) in the From column when displaying a message which you have sent. Default value is '0'.

`folder_search_wildcard`

  The type-ahead function in the Select Folder window will match any part of the folder name ('1') or just the start of the folder name ('0'). Default value is '1'.

`folderview_vscrollbar_policy`

  Specify the policy of vertical scrollbar of Folder List: '0' is always shown, '1' is automatic and '2' is always hidden. Default value is '0'.

`hide_timezone`

  If enabled ('1') the timezone in date headers is set to the unknown timezone value, as specified in section 3 of the RFC 5322. Default value is '0'.

`hover_timeout`

  Time in milliseconds that will cause a folder tree to expand when the mouse cursor is held over it during drag 'n' drop. Default value is '500'.

`live_dangerously`

  Don't ask for confirmation before definitive deletion of emails when set to '1'. Default value is '0'.

`log_error_color`
`log_in_color`
`log_msg_color`
`log_out_color`
`log_warn_color`
`log_status_ok_color`
`log_status_nok_color`
`log_status_skip_color`

  The colours used in the log window. Default values are: '#af0000' (dark red), '#000000' (black), '#00af00' (dark lime green), '#0000ef' (blue), '#af0000' (dark red), '#00af00' (dark lime green), '#0000af' (dark blue) and '#aa00aa' (dark magenta) respectively.

`master_passphrase_pbkdf2_rounds`

  Number of rounds (or iterations) to use in PBKDF2 function when computing next master passphrase key derivation. Currently stored master passphrase KD is not affected by changing this preference. Default value is '50000'.

`msgview_date_format`

  '0' or '1'. Use the same user-defined date format in the Message View as is used in the Message List. Default is '0', turned off.

`nav_history_length`

  Controls the number of messages remembered for navigation with the "Previous opened message" and "Next opened message" options. These options are available within the "Go to" submenu of main window's "View" menu. Default value is 50.

`next_on_delete`

  '0' or '1'. Controls the message selection after deleting, moving, or trashing a message. Default is '0', select previous message.

`outgoing_fallback_to_ascii`

  '0' or '1'. The outgoing encoding of a message will use 7bit US-ASCII whenever it is suitable for the message content, ignoring the Outgoing encoding option unless it is necessary. Turning this option off forces the user-defined encoding to be used, regardless of message content. Default is '1', turned on.

`primary_paste_unselects`

  '0' or '1'. Causes the primary buffer to be cleared and the insertion point to be repositioned when the middle mouse button is used for pasting text. Default is '0', turned off.

`qs_active_color`
`qs_active_bgcolor`
`qs_error_color`
`qs_error_bgcolor`

  Foreground and background colors to use in the QuickSearch field when the search is active and when there is a syntax error. Default values are '#000000' (black), '#f5f6be' (pale yellow), '#000000' (black), and '#ff7070' (pale red), respectively.

`qs_press_timeout`

  Quicksearch type-ahead timeout (in ms): while you're typing in the quicksearch value area in type-ahead mode, this is the delay between two keystrokes after which the search is performed. By default: 500.

`respect_flowed_format`

  '0' or '1'. Respect `format=flowed` on `text/plain` message parts. This will cause some mails to have long lines, but will fix some URLs that would otherwise be wrapped. Default is '0', turned off.

`rewrite_first_from`

  '0' or '1'. This works around a limitation of some servers with 'overly-liberal parsers'. When this is turned on and the Content- Transfer-Encoding is set to 8bit or 7bit, in a message body starting with 'From ' the 'From ' will become '=46rom ' and the Content-Transfer-Encoding will be changed to Quoted-Printable. When it is turned off no such modification will be made but it is very likely that an MTA will convert the 'From ' to '>From '. See RFC 4155 for further details. Default value is '1', turned on.

`save_parts_readwrite`

  If set to '1' saves temporary files when opening attachments with write bit set. Default value is '0', temporary files are read only.

`show_compose_margin`

  '0' or '1'. Adds margins to the message text area in the Compose window. Default is '0', turned off.

`show_inline_attachments`

  '0' or '1'. Show inline attachments in MimeView. Default is '1', turned on.

`skip_ssl_cert_check`

  Disables the verification of SSL certificates when set to '1'. Default value is '0'.

`statusbar_update_step`

  Update stepping in progress bars. Default value is '10'.

`stripes_color_offset`

  Specify the value to use when creating alternately coloured lines in `GtkTreeView` components. The smaller the value, the less visible the difference in the alternating colours of the lines. Default value is '4000'.

`tags_color`
`tags_bgcolor`

  Foreground and background colors to use when displaying tags. Default values are '#000000' (black) and '#f5f6be' (pale yellow), respectively.

`textview_cursor_visible`

  Display the cursor in the message view when set to '1'. Default value is '0'.

`thread_by_subject_max_age`

  Number of days to include a message in a thread when using Thread using subject in addition to standard headers. Default value is '10'.

`toolbar_detachable`

  Show handles in the toolbars when set to '1'. Default value is '0'.

`type_any_header`

  Allows to type any header on the compose window header entries when set to '1'. By default ('0') only the entries available from the combobox can be selected.

`two_line_vertical`

  Spread message list information over two lines when using the three column layout when set to '1' (default). Set it to '0' to use only one line.

`unsafe_ssl_certs`

  Allows Claws Mail to remember multiple SSL certificates for a given server/port when set to '1'. This is disabled by default ('0').

`use_networkmanager`

  Use NetworkManager to switch offline automatically. This is enabled by default ('1'). Set it to '0' to ignore NetworkManager.

`use_stripes_everywhere`

  Enable alternately coloured lines in `GtkTreeView` components when set to '1' (default). Set it to '0' to disable them.

`use_stripes_in_summaries`

  Enable alternately coloured lines in the main window `GtkTreeView` components, (Folder List and Message List). The only useful way to use this option is to set it to '0' when `use_stripes_everywhere` is set to '1'.

`utf8_instead_of_locale_for_broken_mail`

  Use UTF-8 encoding for broken mails instead of current locale when set to '1'. Default value is '0'.

`imap_scan_tree_recurs_limit`

  Recursion depth limit for IMAP's rebuild folder tree feature.

`warn_dnd`

  Display a confirmation dialogue on drag 'n' drop of folders when set to '1' (default). Set to '0' to bypass this confirmation.

`warn_sending_many_recipients_num`

  Display a confirmation dialogue when sending a message to a number of recipients larger than the value of this preference. Set to '0' to bypass this confirmation.

`zero_replacement_char`

  Character to show in Folder List counter columns when a folder contains no messages. Default value is '0'.

## Autofaces

Claws Mail allows setting the Face and X-Face headers directly from files, either globally for all defined accounts or on a per-account basis. These files must be placed in the `~/.claws-mail/autofaces/` directory.

If they exist, the global Face and/or X-Face headers for all accounts are taken from the `face` and/or `xface` files respectively. In a similar manner, Face and/or X-Face headers for a specific account can be provided by `face.`accountname and/or `xface.`accountname, where accountname is the name of the account you want this header to be associated with.

If the name of the account contains characters which may be unsuitable for the underlying filesystem (including spaces) these are replaced by underscores (_) when searching for the autofaces of that account. For example, if your account is called <My Mail>, the name for the X-Face filename for that account would be `~/.claws-mail/autofaces/xface._My_Mail_`. Be aware that this feature doesn't check the content of the files, or for duplication of headers, (most mailers, including Claws Mail, will ignore duplicates and display the last one only).