procmail
[Top] [All Lists]

Re: set a different exitcode for each mailbox

2007-09-19 16:25:29
On Thu, Sep 20, 2007 01:07:46 AM +0200, M. Fioretti 
(mfioretti(_at_)nexaima(_dot_)net) wrote:
Hello,

I have a procmailrc file with the standard structure:

-------------------------------------------
Recipe 1
      if (condition)
      file to folder_1

Recipe 2
      if (another condition)
      file to folder_2
....

DEFAULT_FOLDER

--------------------------------------------

I'm calling procmail from a shell script which scans a maildir, on
one message every time . I need the script to know to which folder
procmail delivered a recipe. If I understand correctly, the right or
simplest way to do it is setting EXITCODE, isn't it?

Sorry, still me. I have realized that probably I don't really need to
deliver to folder_N from within procmail. 

I still need to process those messages with procmail because I must do
a lot of checks which are either procmail recipes I have and don't
want to re-implement in other languages, or things for which procmail
is simply much better than any other alternative.

But maybe I just need procmail to analyze the message, tell the
calling script which one of the recipes matched and terminate WITHOUT
delivering anything: I'm working on maildirs, so I can mv messages to
the right folder and/or process them in other ways in the script, if
only procmail tells me which recipe matched.

Therefore, if I understand correctly the documentation, what I need to
do is take the procmailrc file above and replace EVERY folder name,
INCLUDING the default one at the end, with four lines like these:

{
    EXITCODE=N # with a different value of N for every recipe
    HOST
}

Does this make sense? If yes, which ranges of N must be avoided,
because they correspond to procmail error codes which signal something
bad happened? I've tried to google "procmail error codes", but didn't
find anything useful

TIA,
        Marco


-- 
Help *everybody* love Free Standards and Free Software
http://digifreedom.net/
____________________________________________________________
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