procmail
[Top] [All Lists]

Re: Little doubt on receipts.

2008-10-03 14:46:45
Ok, sorry for that, i dont know why i didn't put the complete procmailrc
file the first time, it looks like this:



LOGFILE=/var/log/provision/procmail.log
FORMAIL=/usr/bin/formail
SENDMAIL=/usr/sbin/sendmail
RENAME=/usr/local/bin/procesar_adjuntos.sh
VERBOSE=yes

:0
* ^Subject:.*Mensaje SGOBA
* 
^To:.*(testbucle(_at_)lotus[(_dot_)]domain[(_dot_)]com|testbucle(_at_)es[(_dot_)]domain[(_dot_)]com)
        {

                :0 c
                | $FORMAIL -A "X-Processed: yes" | \
                    $SENDMAIL -oi testbucle(_at_)domain(_dot_)com

                :0
                * ^Message-ID:.*<\/[^(_at_)]+
                { MESSAGEID = $MATCH }

                :0 E
                { MESSAGEID='none' }

                DUMMY = `mkdir /emails/testbucle/"$MESSAGEID"`

                :0 fwi
                | ripmime -i - -d /emails/testbucle/$MESSAGEID --syslog
--no-nameless ; \
                $RENAME /emails/testbucle/$MESSAGEID $MESSAGEID 1

                DUMMY = `rmdir /emails/testbucle/"$MESSAGEID"`

        }


:0
* ^Subject:.*(Inicio de
=?iso-8859-2?Q?tramitaci=F3n_de_solicitudes_para_036?=)
* 
^To:.*(preselec(_at_)lotus[(_dot_)]domain[(_dot_)]com|preselec(_at_)es[(_dot_)]domain[(_dot_)]com)
        {

                :0 c
                | $FORMAIL -A "X-Processed: yes" | \
                    $SENDMAIL -oi gpg(_at_)domain(_dot_)com

                :0 c
                | $FORMAIL -A "X-Processed: yes" | \
                    $SENDMAIL -oi preselec(_at_)domain(_dot_)com

                :0
                * ^Message-ID:.*<\/[^(_at_)]+
                { MESSAGEID = $MATCH }

                :0 E
                { MESSAGEID='none' }

                DUMMY = `mkdir /emails/preselec/"$MESSAGEID"`

                :0 fwi
                | ripmime -i - -d /emails/preselec/$MESSAGEID --syslog
--no-nameless ; \
                $RENAME /emails/preselec/$MESSAGEID $MESSAGEID 2

                DUMMY = `rmdir /emails/preselec/"$MESSAGEID"`

        }

:0c
* ^Subject:
* ^From:
* ^To:
        {
                :0
                {
                  MESSAGEID2=`${FORMAIL} -cX "Message-ID:" |sed -e 's/[
\t]\{1,\}//g'`
                  SUBJECT=`${FORMAIL} -cX "Subject:"`
                  FROM=`${FORMAIL} -cX "From:"`
                  TO=`${FORMAIL} -cX "To:"`
                  DATE=`${FORMAIL} -cX "Date:"`
                  ADDR=`${FORMAIL} -cX "Received: from"`
                }

                :0i
                | echo -e
"$DATE\n$MESSAGEID2\n$SUBJECT\n$FROM\n$TO\n$ADDR\n" >>
/var/log/provision/reenvios.log

        }


:0w:
| /home/vpopmail/bin/vdelivermail '' /home/vpopmail/domains/
es.domain.com/backup


These are the 4 recipes, what i'm tryng to do is:

If an email matches recipe 1 or 2, then finish there, if it doesn't match 1
o 2, then do 3 and 4.

Sorry for my ignorace, i'm trying my best, i'll be glad to make every change
you guys recommend me to...

Thanks again to everybody.

Joel.



2008/10/3 Dallman Ross <dman(_at_)nomotek(_dot_)com>

On Fri, Oct 03, 2008 at 07:18:19AM -0700, Professional Software
Engineering wrote:

* 
^To:.*(jazzbucle(_at_)lotus[(_dot_)]domain[(_dot_)]com|jazzbucle(_at_)es[(_dot_)]domain[(_dot_)]com)

If you want to match DOTS, rather than putting them into a
character class, just escape them properly:

        \.

Here I disagree.  Not vehemently, but I disagree, nevertheless.

Both will work to give the same result.  A slash has many other
nuanced uses and sometimes has to be quoted -- e.g., when it's the
first character on the right of a comparison expression:

  * FOO ?? \.ar

will match FOO when its value was "bar"; so we'd need, there,

  * FOO ?? ()\.ar

or something equivalent.


Here's the recited proof:

 4:40pm [~/Mail] 553[0]> cat rc

  FOO = bar

  :0
 * FOO ?? \.ar
 { yes }


  4:40pm [~/Mail] 554[0]> procmail -m DEFAULT=/dev/null VERBOSE=y rc <
/dev/null
 procmail: [15708] Fri Oct  3 16:40:34 2008
 procmail: Assigning "MAILDIR=."
 procmail: Rcfile: "rc"
 procmail: Assigning "FOO=bar"
 procmail: Match on "\.ar"
 procmail: Assigning "yes"
 procmail: Assigning "LASTFOLDER=/dev/null"
 procmail: Opening "/dev/null"
   Folder: /dev/null
    0


A dot expressed as a char-class is less ambiguous, and often much
easier to read.  I use such wherever I can.  I have seen experienced
hard-core high-level-language programmers do the same and support the
syntax.

The rest of what Sean said, I concur with fully.

Dallman
____________________________________________________________
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

____________________________________________________________
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
<Prev in Thread] Current Thread [Next in Thread>