<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/xhtml; charset=utf-8">
</head>
<body><div style="font-family: sans-serif;"><div class="markdown" style="white-space: normal;">
<p dir="auto">On 1 Aug 2024, at 17:08, Patrik Fältström via mailmate wrote:</p>
<blockquote style="margin: 0 0 5px; padding-left: 5px; border-left: 2px solid #777777; color: #777777;">
<p dir="auto">On 1 Aug 2024, at 16:48, Randall Gellens wrote:</p>
<blockquote style="margin: 0 0 5px; padding-left: 5px; border-left: 2px solid #777777; border-left-color: #999999; color: #999999;">
<p dir="auto">I do this with virtual mailboxes with conditions.</p>
</blockquote>
<p dir="auto">I am trying to do the same, but with a bundle-action (which does not work for me). Debugging is hard.</p>
<p dir="auto">See this that I sent earlier on this list.</p>
<p dir="auto">Anyone tried this?</p>
</blockquote>
<p dir="auto">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.)</p>
<p dir="auto">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 <code style="margin: 0 0; padding: 0 0.25em; border-radius: 3px; background-color: #F7F7F7;">uuidgen</code> command.</p>
<p dir="auto">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 <code style="margin: 0 0; padding: 0 0.25em; border-radius: 3px; background-color: #F7F7F7;">#date</code> and even better to use <code style="margin: 0 0; padding: 0 0.25em; border-radius: 3px; background-color: #F7F7F7;">#date-received</code>. Also note that <code style="margin: 0 0; padding: 0 0.25em; border-radius: 3px; background-color: #F7F7F7;">#date-received.month</code> 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).</p>
<p dir="auto">Finally, you might want to take advantage of the <code style="margin: 0 0; padding: 0 0.25em; border-radius: 3px; background-color: #F7F7F7;">moveMessage</code> 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).</p>
<p dir="auto">Here is the result after making the changes described above:</p>
<pre style="margin-left: 15px; margin-right: 15px; padding: 5px; background-color: #F7F7F7; border-radius: 5px 5px 5px 5px; overflow-x: auto; max-width: 90vw;"><code style="margin: 0 0; border-radius: 3px; background-color: #F7F7F7; padding: 0px;">{
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';
}
</code></pre>
<p dir="auto">--<br>
Benny</p>
</div>
</div>
</body>
</html>