procmail
[Top] [All Lists]

Re: forward to multiple users

2004-01-27 10:58:44
Thanks Sean B. Straw for the reply.
I changed my filter rule as suggested and it worked. But the forward rule
is still not working.
Both ok and list file contain just email address per line.
with the forwarding rule,
:0
! `sed -e :a -e '$!N' -e '$!ba' -e 's-\n-\ -g' < $HOME/list`

it tried to forward mail to  "sed -e :a -e '$!N' -e '$!ba' -e 's-\n-\ -g'
< $HOME/list" rather than interpreating it as shell command.

Looking for your help.



At 16:34 2004-01-27 +0545, Suryaman Maharjan did say:
I have an emai account, say user1, and I am using .procmailrc file with
the following recepe so that only the users with email accounts listed
on file 'ok' can send email to the account user1.

:0:
* !? (formail -x from |egrep -is -f /home/user1/ok)
/dev/null

:0 h
CLEANFROM=|formail -IReply-To -rtzxTo:

:0
* !? grep -i ^${CLEANFROM}$ ${HOME}/ok
/dev/null

Notes:

That CLEANFROM is exactly as obtained in my SANDBOX (see my .sig), which
 would be a good thing for you to review in any event.

No lockfile flag on the recipe - you're delivering to /dev/null, not a
regular file.

No -s option to egrep.  In fact, egrep isn't the most efficient grep to
run  - if you were shooting for just the syntax you used, fgrep would be
better,  but plain grep is fine.  /home/user1 replaced with $HOME -
makes the rcfile  infinitely more portable.

I want to forward the mail coming to the account user1 to a group of
users listed in file 'list'.

I have tried by appending the following to the .procmailrc file but
without luck

:0
! 'cat /home/user1/list'

Those look curiously like they're NOT backtics:  `cat blah`

A LOGFILE, esp. with a VERBOSE=ON, would have caught this.  That should
*ALWAYS* be your first diagnostic.

Further, if you use a good SANDBOX (again, please refer to my .sig),
this  would have been caught -- besides LOGGING, since my SANDBOX
redefines  $SENDMAIL, your error would have been logged as the
parameters to the MSA:

         X-MTA-Parameters: -oi cat /home/user1/list

instead of say, an expanded addressee list.

Your MTA will probably want the addresses all on one line, so the
forward  rule should probably be more like:

:0
! `sed -e :a -e '$!N' -e '$!ba' -e 's-\n-\ -g' < $HOME/list`

For the uninitiated, this will load the list into sed's pattern space
and  then replace newlines with spaces.  This takes a
one-address-per-line file  and makes it into an
MSA-invocation-compatible list of recipients.

BTW, I'd suspect that your "ok" list at the top and this list might
really  be the SAME (i.e. users of the list can post to it), unless the
'ok' list  is limited to moderators or somesuch.

Check the archives - there are some mailing list recipe sets which have
been gone over in some detail (for quite a while, I ran some of my own
making which did the whole header rewrite thing and all that).  Notable
things which you should concern yourself with are MAIL LOOPS, BOUNCES,
and  REPLIES.


For future reference, when reporting that something doesn't work,
besides  FIRST checking with logging, you should report the _ERROR_ that
occurs, and  as appropriate, the format of files which you refer to (you
neglected to do  this for either 'ok' or 'list').

---
  Sean B. Straw / Professional Software Engineering

  Procmail disclaimer:
<http://www.professional.org/procmail/disclaimer.html> Please DO NOT
carbon me on list replies.  I'll get my copy from the list.


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




_______________________________________________
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>