[MlMt] Rules with variables in them?

Patrik Fältström paf at paftech.se
Sat Mar 16 06:19:02 EDT 2024


Believe it or not, but I have started to dig into this *now* 7,5 years later.

But I can not get it to work.

Maybe the bundle spec have changed?

The attached is what I try to do. And I try to debug, but when triggering the action, I get exactly zero output part from the following when I run MailMate in the terminal:

2024-03-16 11:12:12.943 MailMate[50646:2638116] performBundleItemWithUUIDString: C6B05304-5FA5-416A-820D-2B19893C85F2

That is good of course, but then?

What I try to do which is different from what Benny had as example, is to move the message to a different account, and also I am using a variable date.year that might not exist? But that should give an error I presume?

Bundle is attached.

Patrik

On 31 Oct 2016, at 14:18, Benny Kjær Nielsen wrote:

> On 31 Oct 2016, at 4:10, Patrik Fältström wrote:
>
>> I have one mailbox where I have the name of subfolders in the form of "${#date.month}".
>>
>> Can I also use that expression in one way or another in the rules?
>>
>> For example: "Move to folder /x/${#date.year}/${#date.month}"
>
> Not as easily as that (although it would be nice if it were). The workaround is to create a bundle command and I've attached an example of that. That command can then be used in rules.
>
>> And of course have that folder be created if it does not exist?
>
> That always happens when moving something to a non-existing mailbox.
>
> I should explain the command (since it's undocumented):
>
> ~~~
> {
> 	name          = 'Archive to Date';
> 	environment   = 'MM_FOLDER=${#date.month/-/\\//}\n';
> ~~~
>
> The `environment` is used to “transfer” a header value to the script. In this case a bit of regex is also used to convert `-` to `/`.
>
> ~~~
> 	output        = actions;
> 	command       = '#!/bin/bash
> cat << END
> { actions = ( { type = moveMessage; mailbox = "/Archive/${MM_FOLDER}"; } ); }
> END
> ';
> ~~~
>
> The `actions` output type is used when a script needs MailMate to perform various actions, e.g., setting tags, moving messages, creating new (and possibly send) messages, etc. MailMate expects a property list with the wanted actions. The `moveMessage` type requires a `mailbox` value. When this value starts with `/` then the mailbox name is automatically assumed to be located in the same mailbox as the message moved.
>
> ~~~
> 	uuid          = '57A0FF65-7E0B-4853-8355-A4708FD1BC5E';
> }
> ~~~
>
> Note that if you create other commands then the `uuid` *must* be unique. You can put such a value on the pasteboard with this snippet for a Terminal window:
>
> 	uuidgen | tr -d "\n" | pbcopy
>
> Save the attached bundle in this folder:
>
> 	~/Library/Application Support/MailMate/Bundles/
>
> Note that it should not be necessary to relaunch MailMate when making changes to bundles.
>
> -- 
> Benny
> _______________________________________________
> mailmate mailing list
> mailmate at lists.freron.com
> https://lists.freron.com/listinfo/mailmate
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Move.mmBundle.zip
Type: application/zip
Size: 1209 bytes
Desc: not available
URL: <http://lists.freron.com/pipermail/mailmate/attachments/20240316/31d6ea48/attachment.zip>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 256 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freron.com/pipermail/mailmate/attachments/20240316/31d6ea48/attachment.sig>


More information about the mailmate mailing list