<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>blog.lundscape.com &#187; Formail</title>
	<atom:link href="http://blog.lundscape.com/tag/formail/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.lundscape.com</link>
	<description>The Linux Journey</description>
	<lastBuildDate>Tue, 31 Jan 2012 01:55:34 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Delaying Email Delivery Using Procmail and Cron</title>
		<link>http://blog.lundscape.com/2009/11/delaying-email-delivery-using-procmail-and-cron/</link>
		<comments>http://blog.lundscape.com/2009/11/delaying-email-delivery-using-procmail-and-cron/#comments</comments>
		<pubDate>Mon, 23 Nov 2009 20:17:28 +0000</pubDate>
		<dc:creator>Zachary Lund</dc:creator>
				<category><![CDATA[Procmail]]></category>
		<category><![CDATA[Cron]]></category>
		<category><![CDATA[Formail]]></category>
		<category><![CDATA[Mutt]]></category>
		<category><![CDATA[Spam]]></category>

		<guid isPermaLink="false">http://blog.lundscape.com/?p=279</guid>
		<description><![CDATA[Because I use Mutt, any mailbox that has new mail tends to get my attention when I check my email. This became particularly annoying because I kept opening my spam mailbox to check a single spam message. Therefore, I decided to come up with a way to delay the delivery of my spam to once [...]]]></description>
			<content:encoded><![CDATA[<p>Because I use Mutt, any mailbox that has new mail tends to get my attention when I check my email. This became particularly annoying because I kept opening my spam mailbox to check a single spam message. Therefore, I decided to come up with a way to delay the delivery of my spam to once per day.</p>
<p>I started by changing my &#8220;.procmailrc&#8221; to deliver spam messages to a different mailbox that Mutt does not check.</p>
<pre>MAIL=`echo $HOME/Mail`
[...]
:H
* ^X-Spam-Status: Yes
$MAIL/delay_spam
[...]</pre>
<p>Then I created a new procmailrc file called &#8220;spam.procmailrc&#8221; that would deliver mail to my checked spam mailbox.</p>
<pre>MAIL=`echo $HOME/Mail`

:0
$MAIL/spam</pre>
<p>Next, I wrote a short Bash script to use Formail and Procmail to deliver all of the messages in the delayed delivery spam mailbox to the normal spam mailbox.</p>
<pre>#! /bin/bash

FORMAIL=/usr/bin/formail
PROCMAIL=/usr/bin/procmail
PROCMAILRC=$HOME/.procmail/spam.procmailrc

MAIL=$HOME/Mail
DELAY=$MAIL/delay_spam
TEMP=$MAIL/.spam
LOCK=$TEMP.lock

# Make sure there is delayed mail and we can get the lock (retry once)
if ( test -s $DELAY &#038;&#038; lockfile -r 1 $LOCK 2>/dev/null ); then

    # Add the delayed mail to the temp mailbox and empty the delayed mailbox
    cat $DELAY >> $TEMP &#038;&#038; cat /dev/null > $DELAY
    # Process each delayed message
    $FORMAIL -s $PROCMAIL $PROCMAILRC < $TEMP &#038;&#038; rm -f $TEMP

    # Delete the lock now that we are done
    rm -f $LOCK
fi</pre>
<p>Finally, I set the script to run daily using Cron. Now I am only interrupted by spam when I choose to be instead of every time a new message arrives. I have used the same technique to delay the delivery of emails to unimportant mailing lists so I only read them hourly instead of every time a message arrives.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.lundscape.com/2009/11/delaying-email-delivery-using-procmail-and-cron/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

