<?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>Steve Fortuna &#187; junk mail</title>
	<atom:link href="http://www.stevefortuna.com/tag/junk-mail/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.stevefortuna.com</link>
	<description>Technology Blog</description>
	<lastBuildDate>Thu, 09 Sep 2010 00:33:19 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Postfix Maildrop Spam Folder</title>
		<link>http://www.stevefortuna.com/postfix-maildrop-spam-folder/</link>
		<comments>http://www.stevefortuna.com/postfix-maildrop-spam-folder/#comments</comments>
		<pubDate>Thu, 17 Sep 2009 17:00:17 +0000</pubDate>
		<dc:creator>steve</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[junk mail]]></category>
		<category><![CDATA[maildrop]]></category>
		<category><![CDATA[postfix]]></category>
		<category><![CDATA[spam filtering]]></category>

		<guid isPermaLink="false">http://www.stevefortuna.com/?p=40</guid>
		<description><![CDATA[Filtering spam in Postfix is pretty simple.  There&#8217;s some advanced techniques you can use, but simply setting up Spamassassin will suit many people.  One downside is seeing all the ***** SPAM ***** mails in your inbox.  It took a while to come up with a solution, but the best fit so far has been implementing [...]]]></description>
			<content:encoded><![CDATA[<p>Filtering spam in Postfix is pretty simple.  There&#8217;s some advanced techniques you can use, but simply setting up Spamassassin will suit many people.  One downside is seeing all the ***** SPAM ***** mails in your inbox.  It took a while to come up with a solution, but the best fit so far has been implementing Maildrop to automatically move those files to a Junk folder.  Here&#8217;s the steps to set this up on a Debian 5.0 system with Postfix and Spamassassin.</p>
<p>First, setup your /etc/maildroprc file:</p>
<pre>
# commands and variables for making the mail directories
maildirmake=/usr/bin/maildirmake
mkdir=/bin/mkdir
rmdir=/bin/rmdir
MAILDIR=$DEFAULT

# make the user's mail directory if it doesn't exist
`test -e $MAILDIR`
if ($RETURNCODE != 0)
{
`$mkdir -p $MAILDIR`
`$rmdir $MAILDIR`
`$maildirmake $MAILDIR`
}

# make the .Junk folder if it doesn't exist
JUNK_FOLDER=.Junk
_JUNK_DEST=$MAILDIR/$JUNK_FOLDER/
`test -d $_JUNK_DEST`
if ($RETURNCODE != 0 )
{
`$maildirmake $_JUNK_DEST`
#auto subscribe. the following works for courier-imap
`echo INBOX.Junk &gt;&gt; $MAILDIR/courierimapsubscribed`
}

# If the Spam-Flag is set, move the mail to the Junk folder
if (/^X-Spam-Flag:.*YES/)
{
exception {
to $DEFAULT/.Junk/
}
}
</pre>
<p>The comments clearly state what&#8217;s going on there.</p>
<p>Once that&#8217;s setup, you will go into your /etc/postfix/master.cf and make sure the</p>
<pre>maildrop  unix  -       n       n       -       -       pipe
  flags=DRhu user=vmail argv=/usr/bin/maildrop -d ${recipient}</pre>
<p>is not commented out.</p>
<p>Next you will have to set the /usr/bin/maildrop file setuid root.  This is so maildrop can interact with authdaemon and the mail folders.</p>
<pre>#chmod +s /usr/bin/maildrop</pre>
<p>The last thing you have to do is add this to your /etc/postfix/main.cf file:</p>
<pre>virtual_transport = maildrop
maildrop_destination_recipient_limit = 1</pre>
<p>If there is another virtual_transport line, be sure to comment that out first.</p>
<p>And that&#8217;s all.  Nice and simple way to handle all that Junk mail.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.stevefortuna.com/postfix-maildrop-spam-folder/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>
