procmail
[Top] [All Lists]

Forward a message and alter the subject

2002-05-29 08:45:24
Dear all, 

I need to (as said in the subject) to develop a forwarding system which
allow a user to alter is subject line (to see from "where" the message has
been forwarded). When a user request their mail to be forwarded, we have a
system which update the Sendmail aliases file (users don't have access to
the shell). As I'm new to procmail, I just want to check if this solution is
suitable. 

Example: For the user caran(_at_)ties(_dot_)itu(_dot_)int to forward his mails 
to
caran(_at_)itu(_dot_)int and add before the subject [FW] 

        In the Sendmail aliases file :

                caran: "|IFS=' ' && exec /usr/local/bin/procmail -m
/etc/tiesforward.rc caran(_at_)itu(_dot_)int [FW] ||exit 75 #caran"

        File /etc/forward.rc

                # Housekeeping
                VERBOSE=off
                MAILDIR=/var/spool/mail
                LOGFILE=

                # Extract Subject
                SUBJECT=`formail -cxSubject:`
                FORWARD_TO="$1"
                PREFIX="$2"
                XLOOP=`formail -cxX-Loop:`

                :0
                # Do not forward if a loop is detected
                * ! $ XLOOP ?? ${FORWARD_TO}
                {
                  # Resend the message with altered headers
                        :0
                        | formail -i "Subject: $PREFIX $SUBJECT" -A "X-Loop:
$FORWARD_TO" | $SENDMAIL $SENDMAILFLAGS $FORWARD_TO
                } 

Thanks

Julien
_______________________________________________
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>
  • Forward a message and alter the subject, Caran, Julien <=