<div class="markdown">
<p dir="auto">On 21 Aug 2013, at 0:28, Benny Kjær Nielsen wrote:</p>

<blockquote>
<p dir="auto">On 20 Aug 2013, at 22:05, Christopher LILJENSTOLPE wrote:</p>

<blockquote>
<p dir="auto">[...]<br>
1) Tell spamsieve it's junk<br>
2) Send a copy to the training address(es) of my upstream server<br>
3) Delete it.</p>

<p dir="auto">Is there a way to add scripts to the functions?</p>
</blockquote>

<p dir="auto">Only in the latest test versions and it's both experimental and undocumented :-)</p>
</blockquote>

<p dir="auto">I needed to fix a couple of bugs before I could make it work. Before trying the following you must fetch the latest test release (r3625).</p>

<p dir="auto">Let me first cite part of the release notes for r3587:</p>

<blockquote>
<h3>Rules and Scripts</h3>

<p dir="auto">This is <strong>highly experimental</strong> and don't expect anything to work as expected. I would prefer if anything related to this is only discussed by feedback email or on the mailing list:</p>

<pre><code>defaults write com.freron.MailMate MmTwoPointOhFeaturesEnabled -bool YES
</code></pre>

<p dir="auto">Restart MailMate and the Mailbox Editor of all mailboxes should include a “Rules”<br>
pane. It should then be possible to filter messages and then “Move/Copy to Mailbox”,<br>
“Set/Remove Tag”, “Play Sound”, and “Run Script”. The last one works to some extent, but it's undocumented for now since the “API” is still in flux.</p>

<p dir="auto">You might also notice an empty “Command” menu in the main menu of MailMate. How to use this is also undocumented for now.</p>
</blockquote>

<p dir="auto">The following is what you need to do (I think) to solve your problem.</p>

<p dir="auto">First, unarchive the attached file in this folder:</p>

<pre><code>~/Library/Application Support/MailMate/Bundles/
</code></pre>

<p dir="auto">Second, edit this file:</p>

<pre><code>~/Library/Application Support/MailMate/Bundles/Junk Handling.mmBundle/Commands/SendUpstream.mmCommand
</code></pre>

<p dir="auto">You need to replace two email addresses. One with your own address and another with the upstream address. Ideally, this should be done elsewhere, but we'll hardcode it for now.</p>

<p dir="auto">Third, double-click the universal Junk mailbox and select the Rules pane. Add a rule which only has a set of actions (which are then going to be applied to all messages added to the Junk folder). They should be like this:</p>

<p dir="auto"><img src="cid:157200AF-0EAD-41AC-B7C9-A1784D4D9FF1@freron.com" alt="" title="PastedImage.png"></p>

<p dir="auto">That's it. Now you can try to move a message to the Junk mailbox.</p>

<p dir="auto">Note that the script is also available in the “Command/Junk handling” menu. This is useful for testing the script on selected message(s).</p>

<p dir="auto">Also note that I assume the <code>sendmail</code> Terminal command used in the MailMate command works. I'm a bit unsure on whether or not it works by default on OS X. On my current machine (10.7) it seems Postfix is launched automatically, but I might have configured something in the past. You can watch errors using the following command in the Terminal:</p>

<pre><code>tail -f /var/log/mail.log
</code></pre>

<p dir="auto">I haven't tested with SpamSieve, but in theory that should work as well (when moving to Junk the message is marked as junk and thereby implicitly given to SpamSieve).</p>

<p dir="auto">Feedback is welcome. Don't forget the part about fetching the latest test release.</p>

<p dir="auto">-- <br>
Benny</p>

</div>