Question

Is it possible to create custom action button? ["Junk" button with more complex action]

I would like to:

  1. mark the message as junk
  2. copy the message to special folder common to all email accounts
  3. move the message to per account junk folder

AFAIK Current junk button can deliver 1 and 3 without 2.

I need it for custom reporting to external services e.g. spamcop, knujon and other.


If thunderbird can not deliver such functionality then I am willing to accept suggestion of other Linux email clients capable to deliver such functionality.

Was it helpful?

Solution

Obviously this is easy to do with a custom XUL add-on and some basic Thunderbird chrome scripting.

This can also be done with the Custom Buttons Add-on for Thunderbird. Here is the code for the button, you will need to replace with your own folder URI's. The URI's for the folders can be accessed from the right-click content menu Properties .

/* Code */

// 1. mark the message as junk
goDoCommand("cmd_markAsJunk");

// 2. copy the message to special folder common to all email accounts
var copyUri = "imap://{user}@{host}/{path}/{folder}";
var copyFolder = GetMsgFolderFromUri(copyUri);
MsgCopyMessage(copyFolder);

// 3. move the message to per account junk folder
var moveUri = "mailbox://{user}@Local%20Folders/{spam folder}";
var moveFolder = GetMsgFolderFromUri(moveUri);
MsgMoveMessage(moveFolder);

The button script definitions are stored in the file:

{thunderbird profile}/custombuttons/buttonsoverlay.xul

You may be able to update this file automatically to ease deployment.

WARNING: Thunderbird 31 requires different code.
See https://bugzilla.mozilla.org/show_bug.cgi?id=1043819

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top