1
# Copyright (C) 1998-2009 by the Free Software Foundation, Inc.
3
# This file is part of GNU Mailman.
5
# GNU Mailman is free software: you can redistribute it and/or modify it under
6
# the terms of the GNU General Public License as published by the Free
7
# Software Foundation, either version 3 of the License, or (at your option)
10
# GNU Mailman is distributed in the hope that it will be useful, but WITHOUT
11
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15
# You should have received a copy of the GNU General Public License along with
16
# GNU Mailman. If not, see <http://www.gnu.org/licenses/>.
18
"""Process emailed commands.
20
Called by the wrapper, stdin is the mail message, and argv[1] is the name
21
of the target mailing list.
23
Errors are redirected to logs/error.
29
from mailman import Utils
30
from mailman import loginit
31
from mailman.configuration import config
32
from mailman.i18n import _
33
from mailman.queue import Switchboard
39
# Setup logging to stderr stream and error log.
40
loginit.initialize(propagate=True)
41
log = logging.getLogger('mailman.error')
43
listname = sys.argv[1]
45
log.error(_('request script got no listname.'))
47
# Make sure the list exists
48
if not Utils.list_exists(listname):
49
log.error(_('request script, list not found: $listname'))
51
# Immediately queue the message for the bounce/cmd qrunner to process.
52
# The advantage to this approach is that messages should never get lost --
53
# some MTAs have a hard limit to the time a filter prog can run. Postfix
54
# is a good example; if the limit is hit, the proc is SIGKILL'd giving us
55
# no chance to save the message.
56
cmdq = Switchboard(config.CMDQUEUE_DIR)
57
cmdq.enqueue(sys.stdin.read(),
64
if __name__ == '__main__':