summaryrefslogtreecommitdiff
path: root/Mailman/Deliverer.py
diff options
context:
space:
mode:
Diffstat (limited to 'Mailman/Deliverer.py')
-rw-r--r--Mailman/Deliverer.py127
1 files changed, 72 insertions, 55 deletions
diff --git a/Mailman/Deliverer.py b/Mailman/Deliverer.py
index 6c1b75062..33afd030c 100644
--- a/Mailman/Deliverer.py
+++ b/Mailman/Deliverer.py
@@ -1,8 +1,57 @@
import string, os, sys
import mm_cfg, mm_message, mm_err
-# We could abstract these two better...
+# Text for various messages:
+
+POSTACKTEXT = '''
+Your message entitled:
+ %s
+
+was successfully received by %s.
+'''
+
+SUBSCRIBEACKTEXT = '''Welcome to %s!
+
+If you ever want to unsubscribe or change your options (eg, switch to
+or from digest mode), visit the web page:
+
+ %s
+
+You must know your password to change your options or unsubscribe.
+
+Your password is "%s" (no quotes around it).
+
+If you forget your password, don't worry, you will receive a monthly
+reminder telling you what your password is, and how to unsubscribe or
+change your options.
+
+You may also have your password mailed to you automatically off of
+the web page noted above.
+
+
+To post to this list, send your email to:
+
+ %s
+
+%s
+
+%s
+'''
+
+USERPASSWORDTEXT = '''
+This is a reminder of how to unsubscribe or change your configuration
+for the mailing list "%s". You need to have your password for
+these things. YOUR PASSWORD IS:
+
+%s
+
+To make changes, use this password on the web site:
+ %s
+
+Questions or comments? Send mail to Mailman-owner@%s
+'''
+# We could abstract these two better...
class Deliverer:
# This method assumes the sender is list-admin if you don't give one.
def SendTextToUser(self, subject, text, recipient, sender=None):
@@ -17,7 +66,8 @@ class Deliverer:
# This method assumes the sender is the one given by the message.
def DeliverToUser(self, msg, recipient):
- file = os.popen(mm_cfg.SENDMAIL_CMD % (msg.GetSender(), recipient), 'w')
+ file = os.popen(mm_cfg.SENDMAIL_CMD % (msg.GetSender(), recipient),
+ 'w')
try:
msg.headers.remove('\n')
except:
@@ -43,7 +93,8 @@ class Deliverer:
# (precidence, and received).
if remove_to:
# Writing to a file is better than waiting for sendmail to exit
- tmp_file_name = '/tmp/%smailman.%d.digest' % (tmpfile_prefix, os.getpid())
+ tmp_file_name = '/tmp/%smailman.%d.digest' % (tmpfile_prefix,
+ os.getpid())
for item in msg.headers:
if (item[0:3] == 'To:' or
item[0:5] == 'X-To:'):
@@ -55,7 +106,8 @@ class Deliverer:
tmp_file = open(tmp_file_name, 'w+')
tmp_file.write(string.join(msg.headers,''))
- # If replys don't go to the list, then they should go to the real sender
+ # If replys don't go to the list, then they should go to the
+ # real sender
if self.reply_goes_to_list:
tmp_file.write('Reply-To: %s\n\n' % self.GetListEmail())
if header:
@@ -66,7 +118,8 @@ class Deliverer:
tmp_file.close()
file = os.popen("%s %s %s %s %s" %
(os.path.join(mm_cfg.MAILMAN_DIR, "mail/deliver"),
- tmp_file_name, self.GetAdminEmail(), self.num_spawns, to_list))
+ tmp_file_name, self.GetAdminEmail(),
+ self.num_spawns, to_list))
file.close()
@@ -74,12 +127,7 @@ class Deliverer:
subject = msg.getheader('subject')
if not subject:
subject = '[none]'
- body = '''
-Your message entitled:
- %s
-
-was successfully received by %s.
-''' % (subject, self.real_name)
+ body = POSTACKTEXT % (subject, self.real_name)
self.SendTextToUser('Post acknowlegement', body, sender)
def SendSubscribeAck(self, name, password, digest):
@@ -95,34 +143,12 @@ was successfully received by %s.
header = ''
welcome = ''
- body = '''Welcome to %s!
-
-If you ever want to unsubscribe or change your options (eg, switch to
-or from digest mode), visit the web page:
-
- %s
-
-You must know your password to change your options or unsubscribe.
-
-Your password is "%s" (no quotes around it).
-
-If you forget your password, don't worry, you will receive a monthly
-reminder telling you what your password is, and how to unsubscribe or
-change your options.
-
-You may also have your password mailed to you automatically off of
-the web page noted above.
-
-
-To post to this list, send your email to:
-
- %s
-
-%s
-
-%s
-''' % (self.real_name, self.GetScriptURL('listinfo'),
- password, self.GetListEmail(), header, welcome)
+ body = SUBSCRIBEACKTEXT % (self.real_name,
+ self.GetScriptURL('listinfo'),
+ password,
+ self.GetListEmail(),
+ header,
+ welcome)
self.SendTextToUser(subject = 'Welcome To "%s"! %s' % (self.real_name,
digest_mode),
@@ -134,21 +160,12 @@ To post to this list, send your email to:
self.real_name,
recipient = name,
text = self.goodbye_msg)
-
def MailUserPassword(self, user):
- self.SendTextToUser(subject = '%s reminder\n' % self.real_name,
+ self.SendTextToUser(subject = ('%s@%s maillist reminder\n'
+ % (self.real_name, self.host_name)),
recipient = user,
- text = '''
-This is a reminder of how to unsubscribe or change your configuration
-for the mailing list "%s". You need to have your password for these things.
-YOUR PASSWORD IS:
-
-%s
-
-
-Use this password on the web site:
- %s
-
-Mailman@%s
-''' % (self.real_name, self.passwords[user], self.GetScriptURL('listinfo'),
- self.host_name))
+ text = (USERPASSWORDTEXT
+ % (self.real_name,
+ self.passwords[user],
+ self.GetScriptURL('listinfo'),
+ self.host_name)))