def __init__(self, mlist, subject=None, text=None, tomoderators=1): recips = mlist.owner[:] if tomoderators: recips.extend(mlist.moderator) # We have to set the owner to the site's -bounces address, otherwise # we'll get a mail loop if an owner's address bounces. sender = Utils.get_site_email(mlist.host_name, 'bounces') lang = mlist.preferred_language UserNotification.__init__(self, recips, sender, subject, text, lang) # Hack the To header to look like it's going to the -owner address del self['to'] self['To'] = mlist.GetOwnerEmail() self._sender = sender
def create(mlist, cgi=False, nolock=False, quiet=False): if mlist is None: return listname = mlist.internal_name() fieldsz = len(listname) + len('-unsubscribe') if cgi: # If a list is being created via the CGI, the best we can do is send # an email message to mailman-owner requesting that the proper aliases # be installed. sfp = StringIO() if not quiet: print >> sfp, _("""\ The mailing list `%(listname)s' has been created via the through-the-web interface. In order to complete the activation of this mailing list, the proper /etc/aliases (or equivalent) file must be updated. The program `newaliases' may also have to be run. Here are the entries for the /etc/aliases file: """) outfp = sfp else: if not quiet: print C_("""\ To finish creating your mailing list, you must edit your /etc/aliases (or equivalent) file by adding the following lines, and possibly running the `newaliases' program: """) print C_("""\ ## %(listname)s mailing list""") outfp = sys.stdout # Common path for k, v in makealiases(listname): print >> outfp, k + ':', ((fieldsz - len(k)) * ' '), v # If we're using the command line interface, we're done. For ttw, we need # to actually send the message to mailman-owner now. if not cgi: print >> outfp return # Send the message to the site -owner so someone can do something about # this request. siteowner = Utils.get_site_email(extra='owner') # Should this be sent in the site list's preferred language? msg = Message.UserNotification( siteowner, siteowner, _('Mailing list creation request for list %(listname)s'), sfp.getvalue(), mm_cfg.DEFAULT_SERVER_LANGUAGE) msg.send(mlist)
def create(mlist, cgi=False, nolock=False, quiet=False): if mlist is None: return listname = mlist.internal_name() fieldsz = len(listname) + len('-unsubscribe') if cgi: # If a list is being created via the CGI, the best we can do is send # an email message to mailman-owner requesting that the proper aliases # be installed. sfp = StringIO() if not quiet: print >> sfp, _("""\ The mailing list `%(listname)s' has been created via the through-the-web interface. In order to complete the activation of this mailing list, the proper /etc/aliases (or equivalent) file must be updated. The program `newaliases' may also have to be run. Here are the entries for the /etc/aliases file: """) outfp = sfp else: if not quiet: print _("""\ To finish creating your mailing list, you must edit your /etc/aliases (or equivalent) file by adding the following lines, and possibly running the `newaliases' program: """) print _("""\ ## %(listname)s mailing list""") outfp = sys.stdout # Common path for k, v in makealiases(listname): print >> outfp, k + ':', ((fieldsz - len(k)) * ' '), v # If we're using the command line interface, we're done. For ttw, we need # to actually send the message to mailman-owner now. if not cgi: print >> outfp return # Send the message to the site -owner so someone can do something about # this request. siteowner = Utils.get_site_email(extra='owner') # Should this be sent in the site list's preferred language? msg = Message.UserNotification( siteowner, siteowner, _('Mailing list creation request for list %(listname)s'), sfp.getvalue(), mm_cfg.DEFAULT_SERVER_LANGUAGE) msg.send(mlist)
def __init__(self, mlist, subject=None, text=None, tomoderators=1): recips = mlist.owner[:] if tomoderators: recips.extend(mlist.moderator) # We have to set the owner to the site's -bounces address, otherwise # we'll get a mail loop if an owner's address bounces. sender = Utils.get_site_email(mlist.host_name, 'bounces') lang = mlist.preferred_language UserNotification.__init__(self, recips, sender, subject, text, lang) # Hack the To header to look like it's going to the -owner address del self['to'] self['To'] = mlist.GetOwnerEmail() self._sender = sender # User notifications are normally sent with Precedence: bulk. This # is appropriate as they can be backscatter of rejected spam. # Owner notifications are not backscatter and are perhaps more # important than 'bulk' so give them Precedence: list by default. # (LP: #1313146) self['Precedence'] = 'list'
def remove(mlist, cgi=False): listname = mlist.internal_name() fieldsz = len(listname) + len('-unsubscribe') if cgi: # If a list is being removed via the CGI, the best we can do is send # an email message to mailman-owner requesting that the appropriate # aliases be deleted. sfp = StringIO() print >> sfp, _("""\ The mailing list `%(listname)s' has been removed via the through-the-web interface. In order to complete the de-activation of this mailing list, the appropriate /etc/aliases (or equivalent) file must be updated. The program `newaliases' may also have to be run. Here are the entries in the /etc/aliases file that should be removed: """) outfp = sfp else: print C_(""" To finish removing your mailing list, you must edit your /etc/aliases (or equivalent) file by removing the following lines, and possibly running the `newaliases' program: ## %(listname)s mailing list""") outfp = sys.stdout # Common path for k, v in makealiases(listname): print >> outfp, k + ':', ((fieldsz - len(k)) * ' '), v # If we're using the command line interface, we're done. For ttw, we need # to actually send the message to mailman-owner now. if not cgi: print >> outfp return siteowner = Utils.get_site_email(extra='owner') # Should this be sent in the site list's preferred language? msg = Message.UserNotification( siteowner, siteowner, _('Mailing list removal request for list %(listname)s'), sfp.getvalue(), mm_cfg.DEFAULT_SERVER_LANGUAGE) msg['Date'] = email.Utils.formatdate(localtime=1) outq = get_switchboard(mm_cfg.OUTQUEUE_DIR) outq.enqueue(msg, recips=[siteowner], nodecorate=1)
def remove(mlist, cgi=False): listname = mlist.internal_name() fieldsz = len(listname) + len('-unsubscribe') if cgi: # If a list is being removed via the CGI, the best we can do is send # an email message to mailman-owner requesting that the appropriate # aliases be deleted. sfp = StringIO() print >> sfp, _("""\ The mailing list `%(listname)s' has been removed via the through-the-web interface. In order to complete the de-activation of this mailing list, the appropriate /etc/aliases (or equivalent) file must be updated. The program `newaliases' may also have to be run. Here are the entries in the /etc/aliases file that should be removed: """) outfp = sfp else: print _(""" To finish removing your mailing list, you must edit your /etc/aliases (or equivalent) file by removing the following lines, and possibly running the `newaliases' program: ## %(listname)s mailing list""") outfp = sys.stdout # Common path for k, v in makealiases(listname): print >> outfp, k + ':', ((fieldsz - len(k)) * ' '), v # If we're using the command line interface, we're done. For ttw, we need # to actually send the message to mailman-owner now. if not cgi: print >> outfp return siteowner = Utils.get_site_email(extra='owner') # Should this be sent in the site list's preferred language? msg = Message.UserNotification( siteowner, siteowner, _('Mailing list removal request for list %(listname)s'), sfp.getvalue(), mm_cfg.DEFAULT_SERVER_LANGUAGE) msg['Date'] = email.Utils.formatdate(localtime=1) outq = get_switchboard(mm_cfg.OUTQUEUE_DIR) outq.enqueue(msg, recips=[siteowner], nodecorate=1)