Re: [Mailman-Developers] I want to transfer a mail to a program
I am writing a Script. Now what I want to do is when I send a mail to a list member in a mailman, I want to direct the mail to a program which can be a script or a servlet or anything that can execute on the server. The task of this script shall be to save the received mail to a file.
Can some one tell me how this can be done
You probably want to use procmail as a front to mailman. Modify your alias file and run the message through procmail first, and then pass it to mailman. I did a similar trick to block external e-mails to mailman to prevent non-employees being able to subscribe to our internal lists. Mailman cannot do this. Here is the method:
Modify /etc/aliases:
www-request: "|/usr/bin/procmail -m LIST='www' /etc/mail/procmailrc.lists"
This will call procmail instead of mailman. Mailman is called inside the procmail script:
:0 # pass along all mail for eskom
- ^From:.*eskom.co.za | /home/mailman/mail/wrapper mailcmd $LIST
:0 # reply to all mail not from eskom
- !^FROM_DAEMON
- !^X-Loop: owner-${LIST}@lists.eskom.co.za
{
:0 hc
| (formail -r -A"Precedence: bulk"
-A"X-Loop: owner-${LIST}@lists.eskom.co.za" ;
echo "
This is an ESKOM internal mailing list to which you may not
subscribe. If you have any queries, contact owner-${LIST}@lists.eskom.co.za
for further information.") |
$SENDMAIL -t -f owner-${LIST}@lists.eskom.co.za }
:0 # drop all other mail /dev/null
Using this method and the procmailex manpage, you should be able to do what you want.
-- Richard Ellerbrock richarde@eskom.co.za
participants (1)
-
Richard Ellerbrock