<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
    xmlns:dc="http://purl.org/dc/elements/1.1/"
     xmlns:admin="http://webns.net/mvcb/"
     xmlns:content="http://purl.org/rss/1.0/modules/content/"
     xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
	<channel> 

	<title>Comments on: Procmail rule to drop image-attachment spam?</title>
	<link>http://ask.metafilter.com/58466/Procmail-rule-to-drop-imageattachment-spam/</link>
	<description>Comments on Ask MetaFilter post Procmail rule to drop image-attachment spam?</description>
	<pubDate>Sat, 10 Mar 2007 11:35:38 -0800</pubDate>
	<lastBuildDate>Sat, 10 Mar 2007 11:35:38 -0800</lastBuildDate>
	<language>en-us</language>
	<docs>http://blogs.law.harvard.edu/tech/rss</docs>
	<ttl>60</ttl>

	<item>
		<title>Question: Procmail rule to drop image-attachment spam?</title>
		<link>http://ask.metafilter.com/58466/Procmail-rule-to-drop-imageattachment-spam</link>	
		<description>How can I write a procmail rule that would drop messages with GIF or JPEG attachments under 100kB in size? &lt;br /&gt;&lt;br /&gt; The vast majority of junkmail I receive has image attachments. Sometimes I get real mail from friends with image attachments.&lt;br&gt;
&lt;br&gt;
The difference is the file size. Spam attachments are rarely over 100kB, while real pictures from digital cameras are of course much larger.&lt;br&gt;
&lt;br&gt;
How can I write a procmail rule to drop any messages with image attachments under a certain size?</description>
		<guid isPermaLink="false">post:ask.metafilter.com,2007:site.58466</guid>
		<pubDate>Sat, 10 Mar 2007 10:52:58 -0800</pubDate>
		<dc:creator>odinsdream</dc:creator>
		
			<category>procmail</category>
		
			<category>spam</category>
		
			<category>filter</category>
		
			<category>mail</category>
		
			<category>e-mail</category>
		
			<category>email</category>
		
			<category>attachment</category>
		
	</item> <item>
		<title>By: frieze</title>
		<link>http://ask.metafilter.com/58466/Procmail-rule-to-drop-imageattachment-spam#878897</link>	
		<description>What a great and simple idea. Sorry to say I don&apos;t have procmail skills, but since i use apple mail app I am going to write an applescript to do that. Good luck.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2007:site.58466-878897</guid>
		<pubDate>Sat, 10 Mar 2007 11:35:38 -0800</pubDate>
		<dc:creator>frieze</dc:creator>
	</item><item>
		<title>By: odinsdream</title>
		<link>http://ask.metafilter.com/58466/Procmail-rule-to-drop-imageattachment-spam#878915</link>	
		<description>frieze, I also use apple mail most of the time, so if you come up with such a script, I would love to take a look at it.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2007:site.58466-878915</guid>
		<pubDate>Sat, 10 Mar 2007 12:11:39 -0800</pubDate>
		<dc:creator>odinsdream</dc:creator>
	</item><item>
		<title>By: nathan_teske</title>
		<link>http://ask.metafilter.com/58466/Procmail-rule-to-drop-imageattachment-spam#878926</link>	
		<description>Not to continue the hijack, but &lt;a href=&quot;http://www.hawkwings.net/2006/12/20/another-mailapp-rule-to-catch-image-spam/&quot;&gt;this mail filter&lt;/a&gt; nukes most image spam.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2007:site.58466-878926</guid>
		<pubDate>Sat, 10 Mar 2007 12:29:58 -0800</pubDate>
		<dc:creator>nathan_teske</dc:creator>
	</item><item>
		<title>By: rpn</title>
		<link>http://ask.metafilter.com/58466/Procmail-rule-to-drop-imageattachment-spam#878945</link>	
		<description>:0 B:&lt;br&gt;
* Content-Type: image/gif&lt;br&gt;
* &amp;lt; 100000&lt;br&gt;
ImageSpam&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
This rule will put all mails that are smaller than 100000 bytes and contains an gif image (for other image types you can add more rules, changing image/gif to the appropriate mime-type, e.g. image/jpeg) into the folder ImageSpam.  There is a way to specify OR commands, e.g. put different types in the same rule. Don&apos;t remember the syntax now though...&lt;br&gt;
&lt;br&gt;
This rule will run a command searching for some text on the full e-mail - if you get many large mails it might be a bit slow.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2007:site.58466-878945</guid>
		<pubDate>Sat, 10 Mar 2007 13:13:06 -0800</pubDate>
		<dc:creator>rpn</dc:creator>
	</item><item>
		<title>By: Freaky</title>
		<link>http://ask.metafilter.com/58466/Procmail-rule-to-drop-imageattachment-spam#879148</link>	
		<description>Probably better just to do:&lt;br&gt;
&lt;br&gt;
* ^Content-Type: image/&lt;br&gt;
&lt;br&gt;
to match all attachments with an image type, and ignore the subtype.  You can do something like image/(x-)?(jpeg|gif|png|bmp) or so if you really want - that&apos;ll specifically match image/jpeg, image/x-jpeg, etc.&lt;br&gt;
&lt;br&gt;
If you need to whitelist something, remember you can do things like:&lt;br&gt;
&lt;br&gt;
* !^From:.*bla@foo\.com&lt;br&gt;
&lt;br&gt;
To specify a particular pattern should *not* match the rule. If you&apos;ve got more complex needs, you can attach a set of subrules to try if a rule matches:&lt;br&gt;
&lt;br&gt;
:0 B&lt;br&gt;
* ^Content-Type: image/&lt;br&gt;
* &amp;lt; 100000&lt;br&gt;
* &amp;gt; 2000&lt;br&gt;
{&lt;br&gt;
&#160;&#160;:0:&lt;br&gt;
&#160;&#160;* ^From: foo&lt;br&gt;
&#160;&#160;foo&lt;br&gt;
&lt;br&gt;
&#160;&#160;:0:&lt;br&gt;
&#160;&#160;* ^Subject: bar&lt;br&gt;
&#160;&#160;bar&lt;br&gt;
&lt;br&gt;
&#160;&#160;:0:&lt;br&gt;
&#160;&#160;ImageSpam&lt;br&gt;
}</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2007:site.58466-879148</guid>
		<pubDate>Sat, 10 Mar 2007 19:41:57 -0800</pubDate>
		<dc:creator>Freaky</dc:creator>
	</item><item>
		<title>By: RustyBrooks</title>
		<link>http://ask.metafilter.com/58466/Procmail-rule-to-drop-imageattachment-spam#879436</link>	
		<description>I&apos;ve had the simple version of the rule going since it was posted, and it works great.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2007:site.58466-879436</guid>
		<pubDate>Sun, 11 Mar 2007 12:07:04 -0800</pubDate>
		<dc:creator>RustyBrooks</dc:creator>
	</item><item>
		<title>By: frieze</title>
		<link>http://ask.metafilter.com/58466/Procmail-rule-to-drop-imageattachment-spam#880071</link>	
		<description>Yeah, the applescript thing wasn&apos;t that tricky at all. I had it move the files to another folder but the guy in the link just changed the color of the email in your inbox, which is actually a pretty cool idea.&lt;br&gt;
&lt;br&gt;
(*set theOutputFolder to (choose folder) as string&lt;br&gt;
*)&lt;br&gt;
using terms from application &quot;Mail&quot;&lt;br&gt;
	on perform mail action with messages theSelectedMessages for rule theRule&lt;br&gt;
		tell application &quot;Mail&quot;&lt;br&gt;
			repeat with eachMessage in theSelectedMessages&lt;br&gt;
				set theAttachments to every mail attachment of eachMessage&lt;br&gt;
				set numAttachments to length of theAttachments&lt;br&gt;
				&lt;br&gt;
				if numAttachments is equal to 1 then&lt;br&gt;
					&lt;br&gt;
					set theAttachment to item 1 of theAttachments&lt;br&gt;
					set attachmentType to (MIME type of theAttachment)&lt;br&gt;
					set attachmentSize to (file size of theAttachment)&lt;br&gt;
					&lt;br&gt;
					if attachmentType is equal to &quot;image/gif&quot; then&lt;br&gt;
						if attachmentSize is less than 100000 then&lt;br&gt;
							move eachMessage to mailbox &quot;picspam&quot;&lt;br&gt;
						end if&lt;br&gt;
					end if&lt;br&gt;
				end if&lt;br&gt;
			end repeat&lt;br&gt;
		end tell&lt;br&gt;
	end perform mail action with messages&lt;br&gt;
end using terms from&lt;br&gt;
&lt;br&gt;
P.S. It was easy because I cribbed 90% of the code from 2 code examples.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2007:site.58466-880071</guid>
		<pubDate>Mon, 12 Mar 2007 09:59:56 -0800</pubDate>
		<dc:creator>frieze</dc:creator>
	</item>
	</channel>
</rss>
