Skip to content

Instantly share code, notes, and snippets.

@cosmomill
Last active December 17, 2015 18:09
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cosmomill/5650764 to your computer and use it in GitHub Desktop.
Save cosmomill/5650764 to your computer and use it in GitHub Desktop.
Customize subject for Mailman 2.1.18. This patch adds the ability to customize the subject line for the subscribe confirmation message (subscribeack), unsubscribe confirmation message (unsuback), invitation message (invite) and unsubscribe message. Put the template files subscribeack-subj.txt, unsuback-subj.txt, invite-subj.txt or unsub-subj.txt…
diff -Nur Mailman.orig//Deliverer.py Mailman//Deliverer.py
--- Mailman.orig//Deliverer.py 2014-07-16 15:07:22.000000000 +0200
+++ Mailman//Deliverer.py 2014-07-16 14:54:24.000000000 +0200
@@ -67,24 +67,40 @@
'password' : password,
'user' : self.getMemberCPAddress(name),
}, lang=pluser, mlist=self)
+ realname = self.real_name
+ try:
+ subj = Utils.maketext(
+ 'subscribeack-subj.txt',
+ {'realname' : self.real_name,
+ }, mlist=self)
+ except Exception:
+ subj = 'Welcome to the "%(realname)s" mailing list%(digmode)s'
+ pass
if digest:
digmode = _(' (Digest mode)')
else:
- digmode = ''
- realname = self.real_name
+ digmode = ''
msg = Message.UserNotification(
self.GetMemberAdminEmail(name), self.GetRequestEmail(),
- _('Welcome to the "%(realname)s" mailing list%(digmode)s'),
+ _(subj),
text, pluser)
msg['X-No-Archive'] = 'yes'
msg.send(self, verp=mm_cfg.VERP_PERSONALIZED_DELIVERIES)
def SendUnsubscribeAck(self, addr, lang):
+ try:
+ subj = Utils.maketext(
+ 'unsuback-subj.txt',
+ {'realname' : self.real_name,
+ }, mlist=self)
+ except Exception:
+ subj = 'You have been unsubscribed from the %(realname)s mailing list'
+ pass
realname = self.real_name
i18n.set_language(lang)
msg = Message.UserNotification(
self.GetMemberAdminEmail(addr), self.GetBouncesEmail(),
- _('You have been unsubscribed from the %(realname)s mailing list'),
+ _(subj),
Utils.wrap(self.goodbye_msg), lang)
msg.send(self, verp=mm_cfg.VERP_PERSONALIZED_DELIVERIES)
diff -Nur Mailman.orig//MailList.py Mailman//MailList.py
--- Mailman.orig//MailList.py 2014-07-16 15:07:44.000000000 +0200
+++ Mailman//MailList.py 2014-07-16 12:49:38.000000000 +0200
@@ -209,23 +209,37 @@
} + '@' + self.host_name
def GetConfirmJoinSubject(self, listname, cookie):
+ try:
+ text = Utils.maketext(
+ 'invite-subj.txt',
+ {'listname' : listname,
+ }, mlist=self)
+ except Exception:
+ text = 'Your confirmation is required to join the %(listname)s mailing list'
+ pass
+
if mm_cfg.VERP_CONFIRMATIONS and cookie:
cset = i18n.get_translation().charset() or \
Utils.GetCharSet(self.preferred_language)
- subj = Header(
- _('Your confirmation is required to join the %(listname)s mailing list'),
- cset, header_name='subject')
+ subj = Header(_(text), cset, header_name='subject')
return subj
else:
return 'confirm ' + cookie
def GetConfirmLeaveSubject(self, listname, cookie):
+ try:
+ text = Utils.maketext(
+ 'unsub-subj.txt',
+ {'listname' : listname,
+ }, mlist=self)
+ except Exception:
+ text = 'Your confirmation is required to leave the %(listname)s mailing list'
+ pass
+
if mm_cfg.VERP_CONFIRMATIONS and cookie:
cset = i18n.get_translation().charset() or \
Utils.GetCharSet(self.preferred_language)
- subj = Header(
- _('Your confirmation is required to leave the %(listname)s mailing list'),
- cset, header_name='subject')
+ subj = Header(_(text), cset, header_name='subject')
return subj
else:
return 'confirm ' + cookie
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment