<div class="markdown">
<p dir="auto">On 18 Apr 2014, at 4:46, Brett Terpstra wrote:</p>
<blockquote>
<p dir="auto">Are there any input types available besides "canonical"?</p>
</blockquote>
<p dir="auto">Yes, the current input types are:</p>
<ul>
<li><p dir="auto">none (the default)</p>
<p dir="auto">No input</p></li>
<li><p dir="auto">raw</p>
<p dir="auto">The message in its raw format. This is, for example, suitable for exporting messages to other email-capable applications.</p></li>
<li><p dir="auto">decoded</p>
<p dir="auto">MailMate decodes the body part if it is encoded using quoted-printable/base64. This is primarily useful if sending specific body parts to a command. For example, an image would be given to the command in its raw (original) binary format. This is not currently used by any of the included commands.</p></li>
<li><p dir="auto">canonical</p>
<p dir="auto">Text body parts of the message are decoded, deflowed (<code>format=flowed</code>), and converted to UTF-8 equivalent to what happens before displaying a non-HTML message.</p></li>
<li><p dir="auto">html</p>
<p dir="auto">Currently equivalent to what happens before MailMate displays a message in its Webview which means that even a plain text message is converted to HTML. This is probably mainly useful for display purposes.</p></li>
<li><p dir="auto">selection</p>
<p dir="auto">The currently selected text in the message view.</p></li>
<li><p dir="auto">formatted</p>
<p dir="auto">Requires an additional <code>formatString</code> key/value pair for the command. This is mainly useful for obtaining specific information from a large set of messages.</p></li>
</ul>
<p dir="auto">The last one is quite powerful (and fast) if you want to retrieve data for some kind of statistics. For example, retrieve all sender names of all selected messages like this:</p>
<pre><code>formatString = "${from.name:No name available}\n";
</code></pre>
<p dir="auto">This is well suited for further handling, e.g., by standard UNIX commands. For example, a top 10 of senders could be done like this:</p>
<pre><code>sort -f | uniq -ic | sort --reverse --numeric-sort | head -10
</code></pre>
<p dir="auto">If the receiving command can handle it then it's also fine to use the <code>formatString</code> to provide multiple values:</p>
<pre><code>formatString = "${from.name:No name available}\n${subject.body:No subject available}\n";
</code></pre>
<p dir="auto">When/If event types are expanded then it'll be possible to change how MailMate displays messages by making, e.g., <code>canonical</code> -> <code>canonical or</code>html<code>-></code>html` filters. Filtering before generating a reply is also going to be possible, e.g., to remove extraneous whitespace, reflowing, or automatically cut signatures.</p>
<p dir="auto">I guess that makes part of commands semi-documented. You might want to ask about <code>output</code> types as well ;-)</p>
<blockquote>
<p dir="auto">Is there a way to force HTML to the bundle if it exists,</p>
</blockquote>
<p dir="auto">I'd probably need to know your use case to know whether or not MailMate can do what you want. Using the <code>decoded</code> input type, the main problem is that you need some way to tell MailMate to use the HTML body part as the input for the command. This it tricky if not impossible (depending on what you are trying to do).</p>
<blockquote>
<p dir="auto">regardless of preferences?</p>
</blockquote>
<p dir="auto">The commands are never affected by display preferences.</p>
<blockquote>
<p dir="auto">Also, how does MM<em>SELECTED</em>RANGE work when the input to the command isn't the same format as what was selected in the viewer?</p>
</blockquote>
<p dir="auto">In a sense it's never the same format since even a plain text message is displayed as HTML. To provide <code>MM_SELECTED_RANGE</code>, MailMate heuristically re-locates the selected text in the canonical text when a command is executed. This currently does not happen for the <code>html</code> input type.</p>
<p dir="auto">-- <br>
Benny</p>
</div>