summaryrefslogtreecommitdiff
path: root/scripts/mailowner
blob: 829d9ff589561cde79ac61ed966d7b4e5f630daa (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#! /usr/local/bin/python 

"""Send a message to the maillist owner.

This script gets called by the wrapper.

Stdin is the mail message, and argv[1] is the name of the mailing list
whose owner(s) to send mail to."""

__version__ = "$Revision: 417 $"


import sys
sys.path.append('/home/mailman/mailman/modules')

import maillist, mm_message, mm_utils

try:
    sys.stderr = mm_utils.StampedLogger("error", label = 'post',
                                        manual_reprime=1, nofail=0)
except IOError:
    pass                        # Oh well - SOL on redirect, errors show thru.

# Only let one program run at once per list.

# TODO: This *can* fail, and should send back an error message when it does.
current_list = maillist.MailList(sys.argv[1])
try:
    msg = mm_message.IncomingMessage()
    if not current_list.bounce_processing or not current_list.ScanMessage(msg):
	current_list.DeliverToList(msg, current_list.owner, '', '')
# Let another process run.
finally:
    current_list.Unlock()