[MlMt] Actions on old messages, but bundle and not delete
Benny Kjær Nielsen
mailinglist at freron.com
Fri Aug 23 05:08:29 EDT 2024
On 1 Aug 2024, at 17:08, Patrik Fältström via mailmate wrote:
> On 1 Aug 2024, at 16:48, Randall Gellens wrote:
>
>> I do this with virtual mailboxes with conditions.
>
> I am trying to do the same, but with a bundle-action (which does not
> work for me). Debugging is hard.
>
> See this that I sent earlier on this list.
>
> Anyone tried this?
Better late than never. I tried out your bundle command and it didn't
work for me. It wasn't obvious why because of some silent errors (I've
fixed this for the next update.)
Main problem is that the UUID used for the command is not unique. The
same UUID is used for the main “info.plist’ file. When running the
command then MailMate would try to execute this (and fail). A new UUID
can always be created using the `uuidgen` command.
Second problem is the folder name which was based on the original Date
header. This header is often wrong or badly formatted. It's better to
use `#date` and even better to use `#date-received`. Also note that
`#date-received.month` includes both year and month. You might just want
to use this without using the year-only-variant. Alternatively, you'll
have to use some extra formatting (stripping the year).
Finally, you might want to take advantage of the `moveMessage` action
being able to handle a “relative” mailbox name. This will make this
command work relative to the current account (the account of the message
used).
Here is the result after making the changes described above:
```
{
name = 'Archive to Date';
environment =
'MM_FOLDER=${#date-received.year}/${#date-received.month}\n';
executionMode = 'singleMessage';
output = actions;
command = '#!/bin/bash
cat << END
{ actions = ( { type = moveMessage; mailbox = "/Archive/${MM_FOLDER}"; }
); }
END
';
uuid = 'A9A7909A-8E0C-436D-A655-F55F9845B9D7';
}
```
--
Benny
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freron.com/pipermail/mailmate/attachments/20240823/b7c840a8/attachment.htm>
More information about the mailmate
mailing list