procmail
[Top] [All Lists]

Re: [Q] Forwarding from command line dosen't work

2002-03-07 02:29:02
Udi Mottelo <uuddii(_at_)eng(_dot_)tau(_dot_)ac(_dot_)il> writes:
...
      By this emptyrc file I can copy folder to users inbox with
      no su(1)ing:

formail -s procmail ./emptyrc -m DEFAULT=/var/mail/uuddii < file

Do you have an rcfile named "-m"?  If not, why put such an argument on
the procmail command line?  The -m option is only recognized as such if
it comes before all variable assignments and rcfile names.


...
      But not forward:

formail -s procmail ./emptyrc -m DEFAULT="\! 
udi(_at_)post(_dot_)tau(_dot_)ac(_dot_)il" < file

Yep.  Procmail decides whether an action is a forward, pipe, or mail
folder _before_ it expands any variables in the action line.

In this case, the easy way to forward the messages is to just invoke
sendmail instead of procmail:

        formail -s sendmail udi(_at_)post(_dot_)tau(_dot_)ac(_dot_)il < file


The general solution to being able to set a variable to either a forward
address or a mail folder name is to test the form of the value with
something like:

        # If NAME starts with "!", then treat the rest of it as arguments
        # for sendmail
        :0
        * NAME ?? ^^!\/.*
        ! $MATCH

        # Nope, just a mailbox name
        :0 E
        $NAME


Philip Guenther
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>