<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>
<channel>
	<title>Comments on: inotify: procmail for IMAP folders</title>
	<atom:link href="http://peter.makholm.net/2007/05/24/inotify-procmail-for-imap-folders/feed/" rel="self" type="application/rss+xml" />
	<link>http://peter.makholm.net/2007/05/24/inotify-procmail-for-imap-folders/</link>
	<description></description>
	<pubDate>Fri, 21 Nov 2008 21:54:16 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.2</generator>
		<item>
		<title>By: Arne Jørgensen</title>
		<link>http://peter.makholm.net/2007/05/24/inotify-procmail-for-imap-folders/#comment-16987</link>
		<dc:creator>Arne Jørgensen</dc:creator>
		<pubDate>Sun, 01 Jul 2007 12:01:02 +0000</pubDate>
		<guid isPermaLink="false">http://peter.makholm.net/2007/05/24/inotify-procmail-for-imap-folders/#comment-16987</guid>
		<description>I had the same idea as you - and your posting inspired me to actually do something about.

What I wanted was an IMAP-folder called "Report-as-spam" and mail that I move into that folder would be reported ad spam via "spamassassin -r" and then deleted.

I have a setup with Dovecot as IMAP-server and Dovecot is configured to use maildir as its mailstorage format. As opposed to your Cyrus the event from Dovecot is actually MOVED_TO when the mail is moved from $MAILDIR/tmp to $MAILDIR/current.

I used incron (http://inotify.aiken.cz/?section=incron&#38;page=about&#38;lang=en) to run a shell-script that reports and deletes the mail.

My incrontab is (one line):

/var/maildir/arne/.Report-as-spam/cur IN_MOVED_TO /home/arne/usr/bin/report-as-spam $#

A few lessons I learned was that there should be one and only one space between the event and the command. And incron doesn't have a build the shell like syntax like cron -- so don't use "spamassassin -r &#38;&#38; rm $@/$#" as the command.

My report-as-spam shell script is (don't know if it will bw shown correctly -- but there nothing spooky in there):

#!/bin/sh
SPAMFILE=/var/maildir/arne/.Report-as-spam/cur/$1
if [[ -f $SPAMFILE ]]; then
   /usr/bin/spamassassin -r $SPAMFILE &#38;&#38; rm $SPAMFILE &#38;&#38; logger Reported $SPAMFILE as spam
fi</description>
		<content:encoded><![CDATA[<p>I had the same idea as you - and your posting inspired me to actually do something about.</p>
<p>What I wanted was an IMAP-folder called &#8220;Report-as-spam&#8221; and mail that I move into that folder would be reported ad spam via &#8220;spamassassin -r&#8221; and then deleted.</p>
<p>I have a setup with Dovecot as IMAP-server and Dovecot is configured to use maildir as its mailstorage format. As opposed to your Cyrus the event from Dovecot is actually MOVED_TO when the mail is moved from $MAILDIR/tmp to $MAILDIR/current.</p>
<p>I used incron (http://inotify.aiken.cz/?section=incron&amp;page=about&amp;lang=en) to run a shell-script that reports and deletes the mail.</p>
<p>My incrontab is (one line):</p>
<p>/var/maildir/arne/.Report-as-spam/cur IN_MOVED_TO /home/arne/usr/bin/report-as-spam $#</p>
<p>A few lessons I learned was that there should be one and only one space between the event and the command. And incron doesn&#8217;t have a build the shell like syntax like cron &#8212; so don&#8217;t use &#8220;spamassassin -r &amp;&amp; rm $@/$#&#8221; as the command.</p>
<p>My report-as-spam shell script is (don&#8217;t know if it will bw shown correctly &#8212; but there nothing spooky in there):</p>
<p>#!/bin/sh<br />
SPAMFILE=/var/maildir/arne/.Report-as-spam/cur/$1<br />
if [[ -f $SPAMFILE ]]; then<br />
   /usr/bin/spamassassin -r $SPAMFILE &amp;&amp; rm $SPAMFILE &amp;&amp; logger Reported $SPAMFILE as spam<br />
fi</p>
]]></content:encoded>
	</item>
</channel>
</rss>
