| From | Sent On | Attachments |
|---|---|---|
| Anand Buddhdev | Jun 27, 2002 6:01 am | |
| Sam Varshavchik | Jun 27, 2002 6:21 am | |
| Anand Buddhdev | Jun 27, 2002 7:36 am | |
| Sam Varshavchik | Jun 27, 2002 8:04 am | |
| Anand Buddhdev | Jun 28, 2002 3:33 am |
| Subject: | [SOLVED] Re: [courier-users] Re: dynamic delivery from .courier not working right | |
|---|---|---|
| From: | Anand Buddhdev (ar...@anand.org) | |
| Date: | Jun 28, 2002 3:33:41 am | |
| List: | net.sourceforge.lists.courier-users | |
On Thu, Jun 27, 2002 at 11:03:56AM -0400, Sam Varshavchik wrote:
ext = os.environ['EXT']
command = mlm + ' ctlmsg ' + string.split(ext,'-')[0]
So you pop off one off EXT.
command = mlm + ' msg ' + ext print command
However when couriermlm runs, EXT still contains its original value, so couriermlm reads EXT, and will not understand the command.
I don't understand. If I have a .courier-default or a .courier-anand-default, EXT contains the string "anand-help" in both cases, so I would expect that couriermlm, when run out of either file,
I meant DEFAULT. couriermlm reads DEFAULT to determine the control command.
'anand-help' is not a valid control command. 'help' is, but 'anand-help' isn't.
Thanks! I understand now. I changed my code to do DEFAULT=EXT2. I also changed the code to open a pipe directly to couriermlm instead of relying on dynamic delivery, and now it works. I now only have a single .courier-default, containing "|./wrapper" and creating and deleting lists has become easier :) If anyone's interested, find my finished wrapper below:
#!/usr/bin/python
import os, sys, string
ext = os.environ['EXT']
mlm = '/usr/lib/courier/bin/couriermlm' sendmail = '/usr/lib/courier/bin/sendmail' owneraddress = 'post...@celtelplus.com'
if os.environ['EXT2'] == 'owner': # dispatch to list owner command = sendmail + ' -f "' + os.environ['SENDER'] + '" ' + owneraddress elif '-' in ext: # dispatch to list controller command = mlm + ' ctlmsg ' + string.split(ext,'-')[0] else: # address has no special actions, so likely a list # dispatch to list command = mlm + ' msg ' + ext
# DEFAULT contains listname-command. Change it to contain the command only
os.environ['DEFAULT']=os.environ['EXT2']
c=os.popen(command,'w') c.write(sys.stdin.read()) sys.exit(c.close()/256)
-- Anand Buddhdev http://anand.org





