Hello Jonathan,

On Tuesday, September 30, 2003 at 22:23 GMT -0500, electricians were
shocked that Jonathan Angliss [JA] potentially scribbled:

JA>     - Read all the mails in a certain folder

I'll skip most of the filter's details and focus on the template.

JA>     - grab from it:
JA>            * the destination user
JA>            * the quarantine file
JA>            * the spam score

This is easiest using the export to file action and a template.

JA> ,----- [ spam report ]
<snip>
JA> | The message WILL BE delivered to:
JA> | <[destination email]>
JA> |
JA> | The message has been quarantined as:
JA> |    /var/virusmails/[spam file]
<snip>
JA> | Content analysis details:   (12.80 points, 5 required)
JA> `-----

JA> The details I want from this report are:

Fortunately your spam reports seem to have very non-variable anchors
for you to use.  There are a variety of regexps that you could get to
work, but these are the ones that are most appealing to my personal
taste.

JA>     <[destination email]>
%_Email='%-
%RegexpText="(?im-s)^\s*The message WILL BE delivered to:\s*\n\s*(<.*?>)"'%-

JA>     [spam file]
%_Spam_file='%-
%RegexpText="(?im-s)^\s*The message has been quarantined 
as:\s*\n\s*/var/virusmails/(.*?)\s*$"'%-

JA>     12.80
%_Spam_Score='%-
%RegexpText="(?im-s)^\s*Content analysis details:\s*\((.*?)\s*points"'%-

JA>   The last is a variable depending on the score level, the other two
JA>   are variable depending on the file, and email. Is it possible to
JA>   generate a filter in TB, with the aid of some nifty regex to pull
JA>   that information?

Yes, just put the lines above into the export template.  You can get
the formatting right by just using something like:
%_Email   %_Spam_file   %_Spam_Score

JA> I'd like the format to be put into a plain text file, in a tab
JA> delimited format as such:

The tab delimited could be difficult simply because I don't know how
you can convince a TB template to insert tab characters.  I haven't
tried it, but  a quick and dirty way might be to make a one character
text file containing only a TAB character.  Then in your template have
a line:
%_Tab="%Put='<path>\tabfile.txt'"%-

So all in all, your template should look something like:

=====[Begin template]=====
%_Email='%-
%RegexpText="(?im-s)^\s*The message WILL BE delivered to:\s*\n\s*(<.*?>)"'%-
%-
%_Spam_file='%-
%RegexpText="(?im-s)^\s*The message has been quarantined 
as:\s*\n\s*/var/virusmails/(.*?)\s*$"'%-
%-
%_Spam_Score='%-
%RegexpText="(?im-s)^\s*Content analysis details:\s*\((.*?)\s*points"'%-
%-
%_Tab='%Put="<path>/tabfile.txt"'%-
%-
%_Email%_Tab%_Spam_Score%_Tab%_Spam_file
=====[ End  template]=====

Note this isn't tested, but *should* work.  If you'd like me to test
it a bit more, could you please mail me a sample message (offlist)?

-- 
Thanks for writing,
 Januk Aggarwal






________________________________________________________

http://www.silverstones.com/thebat/TBUDLInfo.html

Reply via email to