summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbwarsaw1999-11-24 17:40:12 +0000
committerbwarsaw1999-11-24 17:40:12 +0000
commitce933b8db2f50585d90c55feb20b876361ebbe22 (patch)
treedce52b6c13c193bd5af79829882edd1e3aa9f2a9
parent7f54011d4c5ff0087007d6f21a15bc12fa61d367 (diff)
downloadmailman-ce933b8db2f50585d90c55feb20b876361ebbe22.tar.gz
mailman-ce933b8db2f50585d90c55feb20b876361ebbe22.tar.zst
mailman-ce933b8db2f50585d90c55feb20b876361ebbe22.zip
All the old delivery scripts contact_transport, deliver, dumb_deliver
are being removed as all mail deliver gets migrated to the new pipeline architecture. Eventually some of the bulk mailer functionality may be added back, but not this way.
-rw-r--r--mail/Makefile.in69
-rwxr-xr-xmail/contact_transport69
-rwxr-xr-xmail/deliver158
-rw-r--r--mail/dumb_deliver35
4 files changed, 0 insertions, 331 deletions
diff --git a/mail/Makefile.in b/mail/Makefile.in
deleted file mode 100644
index f5de61da3..000000000
--- a/mail/Makefile.in
+++ /dev/null
@@ -1,69 +0,0 @@
-# Copyright (C) 1998 by the Free Software Foundation, Inc.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-# NOTE: Makefile.in is converted into Makefile by the configure script
-# in the parent directory. Once configure has run, you can recreate
-# the Makefile by running just config.status.
-
-# Variables set by configure
-
-VPATH= @srcdir@
-srcdir= @srcdir@
-bindir= @bindir@
-prefix= @prefix@
-exec_prefix= @exec_prefix@
-
-CC= @CC@
-CHMOD= @CHMOD@
-INSTALL= @INSTALL@
-
-DEFS= @DEFS@
-
-# Customizable but not set by configure
-
-OPT= @OPT@
-CFLAGS= $(OPT) $(DEFS)
-SCRIPTSDIR= $(prefix)/scripts
-
-SHELL= /bin/sh
-
-MODULES= deliver dumb_deliver contact_transport
-
-# Modes for directories and executables created by the install
-# process. Default to group-writable directories but
-# user-only-writable for executables.
-DIRMODE= 775
-EXEMODE= 755
-FILEMODE= 644
-INSTALL_PROGRAM=$(INSTALL) -m $(EXEMODE)
-
-
-# Rules
-
-all:
-
-install:
- for f in $(MODULES); \
- do \
- $(INSTALL) -m $(FILEMODE) $$f $(SCRIPTSDIR); \
- done
-
-finish:
-
-clean:
-
-distclean:
- -rm Makefile
diff --git a/mail/contact_transport b/mail/contact_transport
deleted file mode 100755
index eb3eb30f5..000000000
--- a/mail/contact_transport
+++ /dev/null
@@ -1,69 +0,0 @@
-#! /usr/bin/env python
-#
-# Copyright (C) 1998 by the Free Software Foundation, Inc.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-"""Send a message via local SMTP, or queue it if SMTP port is not responding.
-
-The script takes the following protocol on stdin:
-
- line [1]: sender
- line [2:n+1]: n recipients
- line [n+2]: <empty> - delimiting end of recipients
- line [n+3:]: message content
-"""
-
-import sys, os
-import paths
-
-from Mailman import mm_cfg
-from Mailman import Utils
-from Mailman import OutgoingQueue
-
-from Mailman.mm_cfg import SMTP_MAX_RCPTS
-from Mailman.Logging.Utils import LogStdErr
-
-LogStdErr("error", "contact_transport")
-
-from_addr = sys.stdin.readline()[:-1]
-to_addrs = []
-while 1:
- l = sys.stdin.readline()[:-1]
- if not l:
- break
- to_addrs.append(l)
-text = sys.stdin.read()
-
-#
-# make sure that not more than SMTP_MAX_RCPTS goes into
-# a single smtp delivery
-#
-addr_chunks = Utils.chunkify(to_addrs, SMTP_MAX_RCPTS)
-
-for to_addrs in addr_chunks:
- try:
- queue_id = OutgoingQueue.enqueueMessage(from_addr, to_addrs, text)
- except IOError:
- # Log the error event and reraise the exception.
- (exc, exc_msg, exc_tb) = sys.exc_info()
- sys.stderr.write("IOError writing outgoing queue\n\t%s/%s\n"
- % (str(exc), str(exc_msg)))
- sys.stderr.flush()
- raise exc, exc_msg, exc_tb
- Utils.TrySMTPDelivery(to_addrs, from_addr, text, queue_id)
-
-
-
diff --git a/mail/deliver b/mail/deliver
deleted file mode 100755
index 87e43a263..000000000
--- a/mail/deliver
+++ /dev/null
@@ -1,158 +0,0 @@
-#! /usr/bin/env python
-#
-# Copyright (C) 1998 by the Free Software Foundation, Inc.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-"""Partition a mass delivery into a suitable set of subdeliveries.
-
-The script takes the following protocol on stdin:
-
- line 1: batchnum
- line 2: sender
- line 3...n+2: n recipients
- line n+3: <empty> - delimiting end of recipients
- line n+4: message content
-
-The recipients will be distributed into at most batchnum batches, grouping
-together recipients in the same major domain as much as possible."""
-
-# Heh, heh, heh, this partition reminds me of the knapsack problem ;-)
-# Ie, the optimal distribution here is NP Complete.
-
-import os, sys
-import string, re
-import paths
-from Mailman import mm_cfg
-from Mailman import Utils
-from Mailman.Logging.Utils import LogStdErr
-
-LogStdErr("error", "deliver")
-
-# Settings for pauses during process-depletion (error.EAGAIN) condition.
-REFRACT = 15 # Seconds between fork retries.
-TRIES = 5 # Number of times to retry
-
-def main():
- if not forker():
- # in the child
- try:
- do_child()
- finally:
- os._exit(0)
-
-def do_child():
- LogStdErr("error", "deliver (child)")
-
- domain_info = {}
-
- spawns = string.atol(sys.stdin.readline()[:-1])
- sender = sys.stdin.readline()[:-1]
- to_list = []
- while 1:
- l = sys.stdin.readline()[:-1]
- if not l:
- break
- to_list.append(l)
- text = sys.stdin.read()
-
- if spawns > mm_cfg.MAX_SPAWNS:
- spawns = mm_cfg.MAX_SPAWNS
- if spawns < 1:
- spawns = 1
-
- # Group by domain.
- for addr in to_list:
- parts = re.split('[.@]', addr)
- key = string.join(parts[-2:])
- if not domain_info.has_key(key):
- domain_info[key] = [addr]
- else:
- domain_info[key].append(addr)
- final_groups = BuildGroups(domain_info.values(), len(to_list), spawns)
- ContactTransportForEachGroup(sender, final_groups, text)
-
-def BuildGroups(biglist, num_addrs, spawns):
- biglist.sort(lambda x,y: len(x) < len(y))
- groups = []
- for i in range(spawns-1):
- target_size = num_addrs / (spawns - i)
- if not len(biglist):
- break
- newlist = biglist[0]
- biglist.remove(biglist[0])
- j = 0
- while len(newlist) < target_size:
- if j >= len(biglist):
- break
- if len(newlist) + len(biglist[j]) > target_size:
- j = j + 1
- continue
- newlist = newlist + biglist[j]
- biglist.remove(biglist[j])
- groups.append(newlist)
- num_addrs = num_addrs - len(newlist)
- lastgroup = []
- for item in biglist:
- lastgroup = lastgroup + item
- if len(lastgroup):
- groups.append(lastgroup)
- return groups
-
-def ContactTransport(sender, recip, text):
- """Pipe message parties & text to contact_transport for SMTP transmit."""
- cmd = os.path.join(mm_cfg.SCRIPTS_DIR, "contact_transport")
- proc = os.popen("%s %s" % (mm_cfg.PYTHON, cmd), 'w')
- proc.write("%s\n" % sender)
- for r in recip:
- proc.write("%s\n" % r)
- proc.write("\n")
- proc.write(text)
- proc.close()
-
-def ContactTransportForEachGroup(sender, groups, text):
- if len(groups) == 1:
- ContactTransport(sender,groups[0],text)
- return
- for group in groups:
- if not forker():
- ContactTransport(sender,group,text)
- os._exit(0)
-
-def forker(tries=TRIES, refract=REFRACT):
- """Fork, retrying on EAGAIN errors with refract secs pause between tries.
-
- Returns value of os.fork(), or raises the exception for:
- (1) non-EAGAIN exception, or
- (2) EGAIN exception encountered more than tries times."""
- got = 0
- # Loop until we successfully fork or the number tries is exceeded.
- while 1:
- try:
- got = os.fork()
- break
- except os.error, val:
- import errno, time
- if val[0] == errno.EAGAIN and tries > 0:
- # Resource temporarily unavailable - give time to recover.
- tries = tries - 1
- time.sleep(refract)
- else:
- # No go - reraise original exception, same stack frame and all.
- Utils.reraise()
- return got
-
-if __name__ == "__main__":
- main()
diff --git a/mail/dumb_deliver b/mail/dumb_deliver
deleted file mode 100644
index 15124e379..000000000
--- a/mail/dumb_deliver
+++ /dev/null
@@ -1,35 +0,0 @@
-#! /usr/bin/env python
-#
-# Copyright (C) 1998 by the Free Software Foundation, Inc.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-import os
-
-if not os.fork():
- import string, sys
- def ContactTransport(sender, recip, text):
- cmd = os.path.join(mm_cfg.SCRIPTS_DIR, "contact_transport")
- file = os.popen(string.join([cmd,sender]+recip," "), 'w')
- file.write(text)
- file.close()
-
- sender = sys.argv[2]
- to_list = sys.argv[3:]
- file = open(sys.argv[1], 'r')
- text = file.read()
- file.close()
- ContactTransport(sender, to_list, text)
- os.unlink(sys.argv[1])