procmail
[Top] [All Lists]

Re: 2 quick questions

1996-01-09 17:20:57

[cc'd to sender]


First, how do I add a carrige return to a string, for example I have a 
statement like { ERR="error" }.  I can generate the error message fine, 
but wheen there are multiple errors they are all strung together.  What 
would I put in to add a linefeed to the above statement?

If you're using echo(1) or printf(1) to print the error string, and
not the builting "echo" command, you can use the \n sequence:

     $ /usr/bin/echo "This is\na test."
     This is
     a test.
     $ 

I don't know how this would affect procmail's functioning, if at
all.  Experimentation would definitely be indicated here.  :-)


        | ( echo $ERR ; sed -e 's/^/> /' )

-- cut here --

The > is being interpreted as a redirect.  You need to escape the
redirect by inserting a backslash immediately in front of the >
symbol:  sed -e 's/^/\> /'

Furthermore, sed's "s" directive is for substitution, not insertion.
You would be replacing every line with the two characters "> ".  Use
the special & character (which represents the pattern which the ^
originally matched) in the "replace" part of the directive:

        sed -s 's/^/\> &/'


Also, I would like, as a default, to forward the email to another 
address.  Someone in another message here suggested using the $DEFAULT 
variable.  When I looked it up in the man pages, they seemed to indicate 
that $DEFAULT was the spool directory to send the mail to.  When I 
changed $DEFAULT to the spool directory of the user I want the mail to go 
to, there is an error and the mail is not sent.  Is there an easier 
solution?

Even easier would simply be adding this recipe to the very end of your
.procmailrc:

        :0
        ! user(_at_)where(_dot_)ever(_dot_)blah

Any message which does not trigger any of the previous recipe will
trigger that one.  Procmail will consider the mail to have been
delivered and cease processing.

Luck++;
Phil

-- 
#include<std/disclaimer.h>               The gods do not protect fools. Fools
finger pedwards(_at_)gamma(_dot_)cs(_dot_)wright(_dot_)edu      are protected 
by more capable fools.
email pedwards(_at_)valhalla(_dot_)cs(_dot_)wright(_dot_)edu                    
        -Larry Niven

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