Hello all,
I've tried to write a procmail recipie set to forward a given mail messsage
to a set of users. The user data is stored in a database (Postgres). I
wrote a utility to fetch the data (mailprefs). When run, it emits on
stdout, the text of the query. For example, the command:
mailprefs frankenclone ja(_at_)soft21(_dot_)s21(_dot_)com F
will return "1" or "0" depending on whether I have a forward request set in
the database (1 = yes). The command
mailprefs frankenclone ja(_at_)soft21(_dot_)s21(_dot_)com f
will return the address list (comma separated) (ex:
jantypas(_at_)soft21(_dot_)s21(_dot_)com,
work(_at_)job(_dot_)com)
Given that, the second recipie is causing me trouble. I get a forwarded
message, but no body.
# The user's ID
USERID="otto(_at_)frankenclone(_dot_)s21(_dot_)com"
# Where the mailprefs program lives
MAILPREFS="/usr/local/bin/mailprefs frankenclone"
# The autoresponder recipie (works)
:0 h c
* !^FROM_DAEMON
* ? test `$MAILPREFS $USERID A` = 1
| (formail -r ; $MAILPREFS $USERID a)| $SENDMAIL -t
# The forward recipie -- messages are forwarded, but no body is sent
:0 h c
* !^FROM_DAEMON
* ? test `$MAILPREFS $USERID F` = 1
| formail -r | $SENDMAIL -t `$MAILPREFS $USERID f`
Thanks for any help as always.
John Antypas
ja(_at_)soft21(_dot_)s21(_dot_)com