Russell Nelson wrote:

> Mirko Zeibig writes:
>  > Hello,
>  > whenever a new user is created, he or she is member of several groups
>  > (all, adm, dev etc.) to gain rights using samba and to deliver mail
>  > automatically to every member of the group when mail is sent to all@,
>  > adm@ etc.
>  > Now I use to edit ~alias/.qmail-all, .qmail-adm etc. files and add the
>  > appropriate users manually. I started to write a redirect like this:
>  > | /var/qmail/bin/qmail-inject $(/bin/cat /etc/group | /bin/grep alle: |
>  > /bin/awk -F':' '{print $4}' | /bin/sed 's/,/ /g')
>  > which will alias cause to deliver the message but now the From adress is
>  > rewritten to alias, which was not my goal of course.
>
> Yes, the envelope sender will match the user which sent the mail.  If
> you need it to be something else you should use the -f switch to
> qmail-inject.

Hello,
this I already knew ;-). Now: how to get the sender from the message which
alias will deliver. I could of course just start a thing like getting the
"From" from the first line of the incoming message, strip of the From and use
this as sender:
| (MYFROM=$(head -1 | sed ´s/From\ //´ ; cat - ) | /var/qmail/bin/qmail-inject
-f"$MYFROM" $(/bin/cat /etc/group | /bin/grep alle: |  /bin/awk -F':' '{print
$4}' | /bin/sed 's/,/ /g')
Merry XMas
Mirko

Reply via email to