You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@spamassassin.apache.org by Matt Silva <ma...@storagecommander.com> on 2004/05/06 02:23:43 UTC
Spam Assassin exit code
Hi there, Ive been searching to see if SA has an exit code if it marks
the mail as spam, and
I couldn't find anything conclusive. How can I determine if it has
marked the currently inspected
mail as spam?
I know I can redirect to an out file and then reinspect that file ...
but it seems like a lot overhead.
Thanks,
Matt
--
Matt Silva
Empower Software Technologies, LLC
27851 Bradley Rd. Suite 120
Sun City, CA 92586
PH: (909) 672-6257
WB: www.storagecommander.com
EM: matt@storagecommander.com
Re: Spam Assassin exit code
Posted by Matt Silva <ma...@storagecommander.com>.
Well I never got the spamc to connect to the spamd and so I tried it
with the spamassassin perl script
and it worked so I stuck with what worked. Trust me I rather use the
daemon, but this is a small company
and I have to get it working within a reasonable time and then move on
to other projects.
Joe Emenaker wrote:
> So... hang on a sec... you don't want to re-parse the mail message for
> X-Spam-Status because "it seems like a lot overhead", yet you don't
> mind running the spamassassin program for each message instead of
> running it as a daemon?
>
> - Joe
>
> Matt Silva wrote:
>
>> I'm using the spamassassin perl script file, but I see what you
>> mean. I also need to brush up
>> on my bash scripting skills ... how do you set the process exitcode
>> assuming you can do that with
>> the perl script.
>>
>> Joe Emenaker wrote:
>>
>>> Matt Silva wrote:
>>>
>>>> Hi there, Ive been searching to see if SA has an exit code if it
>>>> marks the mail as spam, and
>>>> I couldn't find anything conclusive. How can I determine if it has
>>>> marked the currently inspected
>>>> mail as spam?
>>>
>>>
>>> A section of the manpage for spamc reads:
>>>
>>> -c Just check if the message is spam or not. Set process
>>> exitcode to 1 is message is spam, 0 if not spam or processing
>>> failure occurs. Will print score/threshold to stdout (as
>>> ints) or 0/0 if there was an error.
>>>
>>> - Joe
>>
>>
>>
>>
>
>
--
Matt Silva
Empower Software Technologies, LLC
27851 Bradley Rd. Suite 120
Sun City, CA 92586
PH: (909) 672-6257
WB: www.storagecommander.com
EM: matt@storagecommander.com
Re: Spam Assassin exit code
Posted by Joe Emenaker <jo...@emenaker.com>.
Matt Silva wrote:
> Ok spamc seems to be working now. So how do I do this ... "-c Just
> check if the message is spam or not. Set process exitcode to 1 is
> message is spam, 0 if not spam or processing failure occurs."
Something like the following should work. Pass it a filename and it
should tell you if it's spam or not. Modify the stuff in the if-then
clauses to do what you want.
For feeding an mbox-style mailbox through it, you probably want to
something like:
cat mbox | formail -s ./mynewspamfilter.sh > mbox.filtered
Actually, if you tell me what you're trying to do, I might have some
ready-to-go scripts to give you. I've got some that take a virus-ridden
inbox and check each message for spam and output the non-spam messages
to something like "mbox.filtered".
---- mynewspamfilter.sh ----
> #!/bin/sh
>
> if(cat "$1" | spamc -c )
> then
> echo "Spam"
> else
> cat "Not Spam"
> fi
Re: Spam Assassin exit code
Posted by Matt Silva <ma...@storagecommander.com>.
Ok spamc seems to be working now. So how do I do this ... "-c Just
check if the message is spam or not. Set process exitcode to 1 is
message is spam, 0 if not spam or processing failure occurs."
Joe Emenaker wrote:
> So... hang on a sec... you don't want to re-parse the mail message for
> X-Spam-Status because "it seems like a lot overhead", yet you don't
> mind running the spamassassin program for each message instead of
> running it as a daemon?
>
> - Joe
>
> Matt Silva wrote:
>
>> I'm using the spamassassin perl script file, but I see what you
>> mean. I also need to brush up
>> on my bash scripting skills ... how do you set the process exitcode
>> assuming you can do that with
>> the perl script.
>>
>> Joe Emenaker wrote:
>>
>>> Matt Silva wrote:
>>>
>>>> Hi there, Ive been searching to see if SA has an exit code if it
>>>> marks the mail as spam, and
>>>> I couldn't find anything conclusive. How can I determine if it has
>>>> marked the currently inspected
>>>> mail as spam?
>>>
>>>
>>> A section of the manpage for spamc reads:
>>>
>>> -c Just check if the message is spam or not. Set process
>>> exitcode to 1 is message is spam, 0 if not spam or processing
>>> failure occurs. Will print score/threshold to stdout (as
>>> ints) or 0/0 if there was an error.
>>>
>>> - Joe
>>
>>
>>
>>
>
>
--
Matt Silva
Empower Software Technologies, LLC
27851 Bradley Rd. Suite 120
Sun City, CA 92586
PH: (909) 672-6257
WB: www.storagecommander.com
EM: matt@storagecommander.com
Re: Spam Assassin exit code
Posted by Joe Emenaker <jo...@emenaker.com>.
So... hang on a sec... you don't want to re-parse the mail message for
X-Spam-Status because "it seems like a lot overhead", yet you don't mind
running the spamassassin program for each message instead of running it
as a daemon?
- Joe
Matt Silva wrote:
> I'm using the spamassassin perl script file, but I see what you mean.
> I also need to brush up
> on my bash scripting skills ... how do you set the process exitcode
> assuming you can do that with
> the perl script.
>
> Joe Emenaker wrote:
>
>> Matt Silva wrote:
>>
>>> Hi there, Ive been searching to see if SA has an exit code if it
>>> marks the mail as spam, and
>>> I couldn't find anything conclusive. How can I determine if it has
>>> marked the currently inspected
>>> mail as spam?
>>
>> A section of the manpage for spamc reads:
>>
>> -c Just check if the message is spam or not. Set process
>> exitcode to 1 is message is spam, 0 if not spam or processing
>> failure occurs. Will print score/threshold to stdout (as
>> ints) or 0/0 if there was an error.
>>
>> - Joe
>
>
>
Re: Spam Assassin exit code
Posted by Matt Silva <ma...@storagecommander.com>.
I'm using the spamassassin perl script file, but I see what you mean. I
also need to brush up
on my bash scripting skills ... how do you set the process exitcode
assuming you can do that with
the perl script.
Joe Emenaker wrote:
> Matt Silva wrote:
>
>> Hi there, Ive been searching to see if SA has an exit code if it
>> marks the mail as spam, and
>> I couldn't find anything conclusive. How can I determine if it has
>> marked the currently inspected
>> mail as spam?
>
>
> A section of the manpage for spamc reads:
>
> -c Just check if the message is spam or not. Set process
> exitcode to 1 is message is spam, 0 if not spam or processing
> failure occurs. Will print score/threshold to stdout (as
> ints) or 0/0 if there was an error.
>
> - Joe
--
Matt Silva
Empower Software Technologies, LLC
27851 Bradley Rd. Suite 120
Sun City, CA 92586
PH: (909) 672-6257
WB: www.storagecommander.com
EM: matt@storagecommander.com
Re: Spam Assassin exit code
Posted by Joe Emenaker <jo...@emenaker.com>.
Matt Silva wrote:
> Hi there, Ive been searching to see if SA has an exit code if it marks
> the mail as spam, and
> I couldn't find anything conclusive. How can I determine if it has
> marked the currently inspected
> mail as spam?
A section of the manpage for spamc reads:
-c Just check if the message is spam or not. Set process
exitcode to 1 is message is spam, 0 if not spam or processing
failure occurs. Will print score/threshold to stdout (as
ints) or 0/0 if there was an error.
- Joe