You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@spamassassin.apache.org by Joe Zitnik <JZ...@hfcc.net> on 2005/05/20 16:45:13 UTC

Custom rule

I'd like to write a custom rule that would allow e-mail in from users
that have an attachment with a weird in house extension like foo.bar . 
How would I do this?

Re: Custom rule

Posted by Eric Wood <er...@interplas.com>.
----- Original Message ----- 
From: Joe Zitnik
> I'd like to write a custom rule that would allow e-mail in from users that 
> have an attachment
> with a weird in house extension like foo.bar .  How would I do this?

How about delivering it before spamassassin sees it in procmail?:

:0
* ^Content-Transfer-Encoding:.*base64
* ^Content-(Type|Disposition):.*$?.*name.*=.*\.(bar|xxx|yyy|zzz)
$DEFAULT


Re: Custom rule

Posted by Matt Kettler <mk...@evi-inc.com>.
Joe Zitnik wrote:
> I'd like to write a custom rule that would allow e-mail in from users
> that have an attachment with a weird in house extension like foo.bar . 
> How would I do this?

You'd need to use a full rule, as body and rawbody won't be able to see the mime
section headers.

You'll want to have the rule target headers like this:
Content-Disposition: attachment; filename="EVI-Attachment-Warning.txt"

Sometimes, these headers wrap like this one:

Content-Disposition: attachment;
	filename="00_non_deliverable.cf"

A full rule won't cover the linewrap, so you need to include an optional \s or .
 after the attachment part.

So something like this should work:

full L_FOO_BAR		/Content-Disposition: attachment;.{0,30}
filename=.{0,50}\.foo\.bar/i



Some files can have an inline disposition, but I doubt your in-house extension
does. That's usually used for text, html and/or graphics that a mail client can
render.