procmail
[Top] [All Lists]

Re: Best way to nest rc files ?? and a formail question

1999-11-28 05:38:57
On Sat, 27 Nov 1999 22:37:17 +0000 (BST), martin(_dot_)ward(_at_)smltd(_dot_)com
(Martin Ward) wrote:
"David W. Tamkin" <dattier(_at_)Mcs(_dot_)Net> writes:
| I've got the following action line which works fine but is long..
| Is there a way I can input the formail options & text from a file??
Second, there is no general solution to reading formail options
from a file,
There is a general Unix solution to reading ANY programs options
from a file:
:0 c
| (formail `cat formail-opts` ; cat $HOME/replies/reply_cobalt_vw) \
  | $SENDMAIL -oi -t -f$SLSPRSN1

Well, yes, but it's not very elegant (because this convenience will
cost you an extra process every time the response is sent off, and if
you need to use tricky quoting in the options, it's hard to get it
right). Another way to "read options from a file" is something like

    :0c
    | respond "$SLSPRSN1" $HOME/replies/reply_cobalt_vw

where respond is in Procmail's PATH and has the right permissions, and
contains something more or less like

    #!/bin/sh

    SENDMAIL=/usr/lib/sendmail

    sender="$1"
    shift

    ( formail -options ; cat "$@" ) |
    $SENDMAIL -oi -t -f"$sender"

where you might have to adjust the value of SENDMAIL to something
suitable for you. (You're obviously free to parametrize different
things instead of the sender and response file(s) if that's what you
need, too.)

But I wouldn't worry too much about the length of the command line.
You can always wrap it with backslashes, like I have done with
Martin's reply above. Just remember that there always has to be a
space before the backslash, and nothing after it.

Hope this helps,

/* era */

-- 
 Too much to say to fit into this .signature anyway: <http://www.iki.fi/era/>
  Fight spam in Europe: <http://www.euro.cauce.org/> * Sign the EU petition