Thank you all for the reply. But please how do I write to the STDOUT for
procmail to use. And how will procmail read from the STDOUT?
Thanks!
--- On Fri, 11/26/10, procmail-request(_at_)lists(_dot_)RWTH-Aachen(_dot_)de
<procmail-request(_at_)lists(_dot_)RWTH-Aachen(_dot_)de> wrote:
From: procmail-request(_at_)lists(_dot_)RWTH-Aachen(_dot_)de
<procmail-request(_at_)lists(_dot_)RWTH-Aachen(_dot_)de>
Subject: procmail Digest, Vol 94, Issue 22
To: procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)de
Date: Friday, November 26, 2010, 5:43 AM
Send procmail mailing list submissions to
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)de
To subscribe or unsubscribe via the World Wide Web, visit
http://mailman.rwth-aachen.de/mailman/listinfo/procmail
or, via email, send a message with subject or body 'help' to
procmail-request(_at_)lists(_dot_)RWTH-Aachen(_dot_)de
You can reach the person managing the list at
procmail-owner(_at_)lists(_dot_)RWTH-Aachen(_dot_)de
When replying, please edit your Subject line so it is more specific
than "Re: Contents of procmail digest..."
Today's Topics:
1. Re: procmail Digest, Vol 94, Issue 21 (Emmanuel Buamah)
2. Re: procmail Digest, Vol 94, Issue 21 (Alan Clifford)
3. Re: procmail Digest, Vol 94, Issue 21 (Richard Ball)
----------------------------------------------------------------------
Message: 1
Date: Fri, 26 Nov 2010 09:06:26 -0800 (PST)
From: Emmanuel Buamah <wasanzy(_at_)yahoo(_dot_)com>
To: procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)de
Subject: Re: procmail Digest, Vol 94, Issue 21
Message-ID:
<213224(_dot_)40595(_dot_)qm(_at_)web120510(_dot_)mail(_dot_)ne1(_dot_)yahoo(_dot_)com>
Content-Type: text/plain; charset="iso-8859-1"
Thank you so much for your reply. I have to explain in detail what I am
actually targeting. I am new to prpcmail, but in the current mail server
(MDaemon)
The way the content filter work is like this:
If the To header contains support(_at_)domain(_dot_)com then a program is run.
This program will query the company's database to see if the sender is a client
or not. If is a client, the script will then tag the subject with the account
manager's id and return a particular exitcode.
Now the content filter will now check the exitcode of the program and use the
new subject to deliver the mail. If a different exit code is return by the
program, then a different action is taken which is to delete the message and
not allow it pass through.
This is the same thing I want to do.
Right now, the procmail is able to run the script and the script too is able to
query the database and tag the subject header, but how to feed this back to
procmail and procmail too should check the exit code and take the necessary
actions on it.
Attach is the script I worked on. Unfortunatly, I don't have the procmailrc on
this pc so I can't send it right now.
I will also go through what you sent and try to work some thing out though am
confuse.
Thanks
--- On Thu, 11/25/10, procmail-request(_at_)lists(_dot_)RWTH-Aachen(_dot_)de
<procmail-request(_at_)lists(_dot_)RWTH-Aachen(_dot_)de> wrote:
From: procmail-request(_at_)lists(_dot_)RWTH-Aachen(_dot_)de
<procmail-request(_at_)lists(_dot_)RWTH-Aachen(_dot_)de>
Subject: procmail Digest, Vol 94, Issue 21
To: procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)de
Date: Thursday, November 25, 2010, 11:00 PM
Send procmail mailing list submissions to
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)de
To subscribe or unsubscribe via the World Wide Web, visit
http://mailman.rwth-aachen.de/mailman/listinfo/procmail
or, via email, send a message with subject or body 'help' to
procmail-request(_at_)lists(_dot_)RWTH-Aachen(_dot_)de
You can reach the person managing the list at
procmail-owner(_at_)lists(_dot_)RWTH-Aachen(_dot_)de
When replying, please edit your Subject line so it is more specific
than "Re: Contents of procmail digest..."
Today's Topics:
1. Exitcode (Emmanuel Buamah)
2. Re: Exitcode (Professional Software Engineering)
----------------------------------------------------------------------
Message: 1
Date: Thu, 25 Nov 2010 13:35:39 -0800 (PST)
From: Emmanuel Buamah <wasanzy(_at_)yahoo(_dot_)com>
To: procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)de
Subject: Exitcode
Message-ID:
<319327(_dot_)33843(_dot_)qm(_at_)web120503(_dot_)mail(_dot_)ne1(_dot_)yahoo(_dot_)com>
Content-Type: text/plain; charset="iso-8859-1"
Hi All,
I have written a script that is being invoked from procmail. Now I want
procmail to wait untill the program finishes and check it's exitcode.
My question is, how do I check the exit code of the script and take an action
on it?
Regards
Emanuel
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://mailman.rwth-aachen.de/pipermail/procmail/attachments/20101125/51623a3f/attachment-0001.html>
------------------------------
Message: 2
Date: Thu, 25 Nov 2010 14:23:20 -0800
From: PSE-L(_at_)mail(_dot_)professional(_dot_)org (Professional Software
Engineering)
To: procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)de
Subject: Re: Exitcode
Message-ID:
<201011252223(_dot_)oAPMNYl0006395(_at_)trei(_dot_)professional(_dot_)org>
Content-Type: text/plain; charset=us-ascii; format=flowed
At 13:35 2010-11-25, Emmanuel Buamah wrote:
My question is, how do I check the exit code of the script and take
an action on it?
As a condition, or as a filter? If as a filter, do you only need
true/false granularity, or to act upon a specific value?
:0fw
| some_script
Would filter the message and wait for the exit code - if it isn't 0
(success), then it treats the message as if the recipe hadn't been
invoked and reverts to the original (unfiltered) message.
:0
* ? some_script
mailbox
Would pump the headers of the message (unless you added hb or b to
the flags line, or H or B to the condition line) into the script and
use the exit code as an inverted true/false (exitcode = 0 = true, any
nonzero, false) for evaluating the condition.
If you invoke a pipeline this way, such as:
* ? grep username | grep something
the exitcode which is evaluated is the one returned by the last
program in the pipeline.
If you want the actual value to subsequently evaluate, then:
DUMMYVAR=`some_program args`
SOME_PROGRAM_EXITCODE=$?
Note that this is outside of a recipe (though it could be within a
braced section).
This is not to be confused for condition lines which may have $? at
the beginning, which would evaluate shell variables and examine the
return value (but isn't an assignment). You'd want to assign the
value to a variable so that you could evaluate it in a condition
without the exitcode variable being evaluated as a pair of
flags. You can use scoring to do math for checking whether the
variable exceeds a certain value.
:0
* -25^0
* $ $SOME_PROGRAM_EXITCODE^0
mailbox
Would evaluate as true if the saved exitcode exceeded 25.
If you just want to match a specific value:
:0
* SOME_PROGRAM_EXITCODE ?? ^25$
mailbox
If you wanted to match for 25 exactly (or ^^25^^ would work).
---
Sean B. Straw / Professional Software Engineering
Procmail disclaimer: <http://www.professional.org/procmail/disclaimer.html>
Please DO NOT carbon me on list replies. I'll get my copy from the list.
------------------------------
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)de
http://mailman.rwth-aachen.de/mailman/listinfo/procmail
End of procmail Digest, Vol 94, Issue 21
****************************************
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://mailman.rwth-aachen.de/pipermail/procmail/attachments/20101126/a09a97cf/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mailfilter
Type: application/octet-stream
Size: 4256 bytes
Desc: not available
URL:
<http://mailman.rwth-aachen.de/pipermail/procmail/attachments/20101126/a09a97cf/attachment-0001.obj>
------------------------------
Message: 2
Date: Fri, 26 Nov 2010 17:38:37 +0000 (GMT)
From: Alan Clifford <lists(_at_)clifford(_dot_)ac>
To: procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
Subject: Re: procmail Digest, Vol 94, Issue 21
Message-ID:
<alpine(_dot_)OSX(_dot_)2(_dot_)00(_dot_)1011261735540(_dot_)178(_at_)coprolith(_dot_)local>
Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed
On Fri, 26 Nov 2010, Emmanuel Buamah wrote:
Thank you so much for your reply. I have to explain in detail what I am
actually targeting. I am new to prpcmail, but in the current mail server
(MDaemon) The way the content filter work is like this:
:0
* subject:.*re:.*procmail digest
/dev/null
--
Alan
( Please address personal email to alan+1@ as email to lists@
is only read from my subscribed lists. )
------------------------------
Message: 3
Date: Fri, 26 Nov 2010 12:43:34 -0500
From: Richard Ball <rgball(_at_)ellerbach(_dot_)com>
To: procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
Subject: Re: procmail Digest, Vol 94, Issue 21
Message-ID: <4CEFF1C6(_dot_)6080201(_at_)ellerbach(_dot_)com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
On 26-11-2010 12:06, Emmanuel Buamah wrote:
Thank you so much for your reply. I have to explain in detail what I
am actually targeting. I am new to prpcmail, but in the current mail
server (MDaemon)
The way the content filter work is like this:
If the To header contains support(_at_)domain(_dot_)com then a program is
run.
This program will query the company's database to see if the sender is
a client or not. If is a client, the script will then tag the subject
with the account manager's id and return a particular exitcode.
Now the content filter will now check the exitcode of the program and
use the new subject to deliver the mail. If a different exit code is
return by the program, then a different action is taken which is to
delete the message and not allow it pass through.
This is the same thing I want to do.
Right now, the procmail is able to run the script and the script too
is able to query the database and tag the subject header, but how to
feed this back to procmail and procmail too should check the exit code
and take the necessary actions on it.
Attach is the script I worked on. Unfortunatly, I don't have the
procmailrc on this pc so I can't send it right now.
I will also go through what you sent and try to work some thing out
though am confuse.
First off, the perl script you attached doesn't do what you describe above.
Sean showed you a number of ways to look at exit codes.
But you can do what you want without exit codes by using inserted
headers instead. Since you are going to be manipulating the message
extensively in the called perl script, just call it as a filter from
procmail and add a specific header according to what you want procmail
to do when the perl script finishes.
Your perl script should read the message on STDIN and write the new
message to STDOUT and that way procmail will have all the information it
needs.
Rich
------------------------------
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)de
http://mailman.rwth-aachen.de/mailman/listinfo/procmail
End of procmail Digest, Vol 94, Issue 22
****************************************
____________________________________________________________
procmail mailing list Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)de
http://mailman.rwth-aachen.de/mailman/listinfo/procmail