From Claws Mail FAQ
Jump to navigationJump to search


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 a replying or forwarding. 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.


Response on top of quoted message :


On %d, %f wrote :


Keep original "To:" in the compose "From:" field when replying :

This is useful when multiple email addresses with the same domain (e.g. sales@domain.com info@domain.com admin@domain.com) are stored in a single folder. If, when replying, you want to have the "From:" field in the compose window automatically populated with the "To:" address from the mail being replied to:

  1. Select the folder Properties => Templates => Reply
  2. Check "Use templates when replying to messages" box
  3. Put something like the following in the "From" box:

|p{/path/to/yourscript %t%c} and in yourscript you can extract the addresses such as echo -n `echo "$*"|grep -o '[a-zA-Z0-9]*@domain.com'`

This works if the address is in the "To:" or "Cc:" fields, but will leave a blank "From:" if the message was sent "Bcc:". The solution is also only valid on Unix/Linux platforms.

Warning: before Claws 3.17.8 the |p{} command is passed to your shell. If %t%c contains special characters interpreted by your shell arbitrary commands can be executed.