<?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: Run an IMAP Tickler file via a Cron script</title>
	<atom:link href="http://www.hawkwings.net/2006/01/23/run-an-imap-tickler-file-via-cron-script/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.hawkwings.net/2006/01/23/run-an-imap-tickler-file-via-cron-script/</link>
	<description>Tips and add-ons to make Apple Mail / Mail.app even better</description>
	<pubDate>Sun, 23 Nov 2008 12:24:18 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
		<item>
		<title>By: Ted Pavlic</title>
		<link>http://www.hawkwings.net/2006/01/23/run-an-imap-tickler-file-via-cron-script/#comment-1034</link>
		<dc:creator>Ted Pavlic</dc:creator>
		<pubDate>Thu, 26 Jan 2006 19:23:11 +0000</pubDate>
		<guid isPermaLink="false">http://www.hawkwings.net/2006/01/23/run-an-imap-tickler-file-via-cron-script/#comment-1034</guid>
		<description>I should mention that there are other ways to mark messages read. The method I used is just consistent with the Maildir folders on my Courier IMAP server. If you don't use Maildirs, you could use formail to with the -A switch and the header "X-Status: 0" (I think I remember correctly; try it and see).</description>
		<content:encoded><![CDATA[<p>I should mention that there are other ways to mark messages read. The method I used is just consistent with the Maildir folders on my Courier IMAP server. If you don&#8217;t use Maildirs, you could use formail to with the -A switch and the header &#8220;X-Status: 0&#8243; (I think I remember correctly; try it and see).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ted Pavlic</title>
		<link>http://www.hawkwings.net/2006/01/23/run-an-imap-tickler-file-via-cron-script/#comment-1033</link>
		<dc:creator>Ted Pavlic</dc:creator>
		<pubDate>Thu, 26 Jan 2006 19:20:41 +0000</pubDate>
		<guid isPermaLink="false">http://www.hawkwings.net/2006/01/23/run-an-imap-tickler-file-via-cron-script/#comment-1033</guid>
		<description>Here's another goody. A procmail script that will automatically file your ticklers based on a key in the subject. 

The idea is that you e-mail yourself a message with a subject starting with "tickle##" where ## is a number from 01 (can be 1 as well) to 31 and procmail will automatically file it AND mark it read in your tickler folders on your IMAP server. You then use my cronjob above to move those into your inbox on the appropriate day.

=====
:0
* ^Subject:[ \t]*\/tickle([0-9]&#124;[0-9][0-9]):.*
{
    # Grab the string that brought us here
    TICKLE=$MATCH

    # If it was a single-digit day, grab it and pad it with a 0
    :0
    * TICKLE ?? ^tickle\/[0-9]:
    * MATCH ?? ()\/[^:]+ 
    { TICKLEDAY="0$MATCH" }

    # Otherwise grab the two-digit day
    :0
    * TICKLE ?? ^tickle\/[0-9][0-9]
    { TICKLEDAY=$MATCH }

    # Calculate the week using bc
    TICKLEWEEK="`echo \"($TICKLEDAY - 1)/7 + 1\"&#124;bc`"

    # Grab the subject that came after the tickle header
    :0
    * TICKLE ?? ^tickle([0-9]&#124;[0-9][0-9]):\/.*
    { TICKLESUBJECT=$MATCH }

    # Make a note in header showing that this rule ran
    :0 f    
    &#124; ${FORMAIL} -A"X-MyProcmailRC: GTD Handler caught TICKLER (White listed)"

    # Update the subject to just have "tickler" up front. If you want to refile it later,
    # just move the message. Notice that -i is used, so the old subject will be saved to
    # Old-Subject: in the header
    :0 f    
    &#124; ${FORMAIL} -i"Subject: tickler:$TICKLESUBJECT"

    # Move the message to appropriate tickler folder for this day
    :0 wc   
    "$MAILDIR/.@TICKLER.Week$TICKLEWEEK.$TICKLEDAY/"

    # Mark it read 
    :0 A hi 
    &#124; mv "$LASTFOLDER" "$LASTFOLDER:2,S"
}
=====

If you cut out a lot of the stuff in the middle that does the tickler stuff, then you can use this as a template for more auto-filing stuff. 

For example, I have a rule that routes messages with subjects starting with "todo:" or "defer:" to a DEFER folder of mine and those starting with "action:" to an ACTION folder.</description>
		<content:encoded><![CDATA[<p>Here&#8217;s another goody. A procmail script that will automatically file your ticklers based on a key in the subject. </p>
<p>The idea is that you e-mail yourself a message with a subject starting with &#8220;tickle##&#8221; where ## is a number from 01 (can be 1 as well) to 31 and procmail will automatically file it AND mark it read in your tickler folders on your IMAP server. You then use my cronjob above to move those into your inbox on the appropriate day.</p>
<p>=====<br />
:0<br />
* ^Subject:[ \t]*\/tickle([0-9]|[0-9][0-9]):.*<br />
{<br />
    # Grab the string that brought us here<br />
    TICKLE=$MATCH</p>
<p>    # If it was a single-digit day, grab it and pad it with a 0<br />
    :0<br />
    * TICKLE ?? ^tickle\/[0-9]:<br />
    * MATCH ?? ()\/[^:]+<br />
    { TICKLEDAY=&#8221;0$MATCH&#8221; }</p>
<p>    # Otherwise grab the two-digit day<br />
    :0<br />
    * TICKLE ?? ^tickle\/[0-9][0-9]<br />
    { TICKLEDAY=$MATCH }</p>
<p>    # Calculate the week using bc<br />
    TICKLEWEEK=&#8221;`echo \&#8221;($TICKLEDAY - 1)/7 + 1\&#8221;|bc`&#8221;</p>
<p>    # Grab the subject that came after the tickle header<br />
    :0<br />
    * TICKLE ?? ^tickle([0-9]|[0-9][0-9]):\/.*<br />
    { TICKLESUBJECT=$MATCH }</p>
<p>    # Make a note in header showing that this rule ran<br />
    :0 f<br />
    | ${FORMAIL} -A&#8221;X-MyProcmailRC: GTD Handler caught TICKLER (White listed)&#8221;</p>
<p>    # Update the subject to just have &#8220;tickler&#8221; up front. If you want to refile it later,<br />
    # just move the message. Notice that -i is used, so the old subject will be saved to<br />
    # Old-Subject: in the header<br />
    :0 f<br />
    | ${FORMAIL} -i&#8221;Subject: tickler:$TICKLESUBJECT&#8221;</p>
<p>    # Move the message to appropriate tickler folder for this day<br />
    :0 wc<br />
    &#8220;$MAILDIR/.@TICKLER.Week$TICKLEWEEK.$TICKLEDAY/&#8221;</p>
<p>    # Mark it read<br />
    :0 A hi<br />
    | mv &#8220;$LASTFOLDER&#8221; &#8220;$LASTFOLDER:2,S&#8221;<br />
}<br />
=====</p>
<p>If you cut out a lot of the stuff in the middle that does the tickler stuff, then you can use this as a template for more auto-filing stuff. </p>
<p>For example, I have a rule that routes messages with subjects starting with &#8220;todo:&#8221; or &#8220;defer:&#8221; to a DEFER folder of mine and those starting with &#8220;action:&#8221; to an ACTION folder.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ted Pavlic</title>
		<link>http://www.hawkwings.net/2006/01/23/run-an-imap-tickler-file-via-cron-script/#comment-990</link>
		<dc:creator>Ted Pavlic</dc:creator>
		<pubDate>Mon, 23 Jan 2006 00:41:19 +0000</pubDate>
		<guid isPermaLink="false">http://www.hawkwings.net/2006/01/23/run-an-imap-tickler-file-via-cron-script/#comment-990</guid>
		<description>It's worth nothing that that script should be run nightly just after midnight. It copies the CURRENT day's contents (and month if the current day is "01") into the inbox. 

Because my IMAP server is on GMT time, I set my cronjob to run at 5:01AM GMT every night. That corresponds to 12:01AM for eastern standard time and 1:01AM for eastern DST. That's fine with me.

Also note that I use mailutil to do the message shuffling. mailutil is made by the same people who make pine. There is a non-standard patch that they release for the most recent versions of pine and mailutil that supports the maildir mailbox format (which uses a hashed directory structure). That patch is available at:

http://www.math.washington.edu/~chappa/pine/info/maildir.html

If your server uses a simpler type of mailbox, you might be able to get away with just concatenating one mailbox onto the other. In that case, you won't need mailutil at all (however, note that mailutil is a very general utility. You can use it to transfer messages from basically any mailbox format to any other mailbox format. It can even connect to remote mailboxes and let you shuffle messages from here to there. It does everything that any IMAP client can do (and more)).</description>
		<content:encoded><![CDATA[<p>It&#8217;s worth nothing that that script should be run nightly just after midnight. It copies the CURRENT day&#8217;s contents (and month if the current day is &#8220;01&#8243;) into the inbox. </p>
<p>Because my IMAP server is on GMT time, I set my cronjob to run at 5:01AM GMT every night. That corresponds to 12:01AM for eastern standard time and 1:01AM for eastern DST. That&#8217;s fine with me.</p>
<p>Also note that I use mailutil to do the message shuffling. mailutil is made by the same people who make pine. There is a non-standard patch that they release for the most recent versions of pine and mailutil that supports the maildir mailbox format (which uses a hashed directory structure). That patch is available at:</p>
<p><a href="http://www.math.washington.edu/~chappa/pine/info/maildir.html" rel="nofollow">http://www.math.washington.edu/~chappa/pine/info/maildir.html</a></p>
<p>If your server uses a simpler type of mailbox, you might be able to get away with just concatenating one mailbox onto the other. In that case, you won&#8217;t need mailutil at all (however, note that mailutil is a very general utility. You can use it to transfer messages from basically any mailbox format to any other mailbox format. It can even connect to remote mailboxes and let you shuffle messages from here to there. It does everything that any IMAP client can do (and more)).</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.246 seconds -->
