[Users] "Global" action to move message within acct

Holger Berndt berndth at gmx.de
Fri Sep 16 23:38:52 CEST 2016

Hello Trevor,

On Di, 13.09.2016 20:51, Trevor Carey-Smith wrote:

>I am trying to set up an action that can be used across multiple
>accounts that will move a message to a specific folder within the
>*current* account.
>So say I have 2 or more IMAP accounts, I want a single action that I
>can assign to one button that will, when I am in Account 1, move any
>selected message(s) to the, say, "special" folder within Account 1. But
>I want the same button, when I am in Account 2, to move selected
>messages to the "special" folder within Account 2.

Scripting this kind of stuff is possible with the Python plugin. A
corresponding quick&dirty script could look like this:

mailbox_folder_map = {
	"mail" : "#mh/mail/foo",
	"gmail (imap)" : "#imap/gmail (imap)/bar"

msgs = clawsmail.get_summaryview_selected_message_list()
if msgs:
	mailbox_name = msgs[0].Folder.mailbox.name
	if mailbox_name in mailbox_folder_map:
		target_folder = clawsmail.Folder(mailbox_folder_map[mailbox_name])
		clawsmail.move_messages(msgs, target_folder)


More information about the Users mailing list