From e4302599c58732d14e2c901092b5e8df13c3f46e Mon Sep 17 00:00:00 2001 From: Jim Popovitch Date: Sun, 3 Mar 2013 15:56:11 -0500 Subject: Send monthly password reminders from virtual list(s), not sitelist --- cron/mailpasswds | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/cron/mailpasswds b/cron/mailpasswds index da643761..831e9ab0 100755 --- a/cron/mailpasswds +++ b/cron/mailpasswds @@ -141,7 +141,9 @@ def main(): for host in byhost.keys(): # Site owner is `mailman@dom.ain' userinfo = {} + virtlist = {} for mlist in byhost[host]: + virtlist = mlist listaddr = mlist.GetListEmail() for member in mlist.getMembers(): # The user may have disabled reminders for this list @@ -218,7 +220,7 @@ def main(): # Add the table to the end so it doesn't get wrapped/filled text += (header + '\n' + NL.join(table)) msg = Message.UserNotification( - addr, siteowner, + addr, sitebounce, _('%(host)s mailing list memberships reminder'), text.encode(enc, 'replace'), poplang) # Note that text must be encoded into 'enc' because unicode @@ -228,11 +230,7 @@ def main(): msg['X-No-Archive'] = 'yes' del msg['auto-submitted'] msg['Auto-Submitted'] = 'auto-generated' - # We want to make this look like it's coming from the siteowner's - # list, but we also want to be sure that the apparent host name is - # the current virtual host. Look in CookHeaders.py for why this - # trick works. Blarg. - msg.send(sitelist, **{'errorsto': sitebounce, + msg.send(virtlist, **{'errorsto': sitebounce, '_nolist' : 1, 'verp' : mm_cfg.VERP_PASSWORD_REMINDERS, }) -- cgit v1.2.3 From 962c9d48558a3545fa2e319fa3033ba3aaead2ec Mon Sep 17 00:00:00 2001 From: Jim Popovitch Date: Sat, 8 Oct 2016 22:35:15 +0000 Subject: Send bounce messages from virtual domains not siteowner --- Mailman/Bouncer.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Mailman/Bouncer.py b/Mailman/Bouncer.py index 29fe4ea5..47955fa3 100644 --- a/Mailman/Bouncer.py +++ b/Mailman/Bouncer.py @@ -224,7 +224,7 @@ class Bouncer: # it was of dubious value). However, we'll provide empty, strange, or # meaningless strings for the unused %()s fields so that the language # translators don't have to provide new templates. - siteowner = Utils.get_site_email(self.host_name) + owneraddr = self.GetOwnerEmail() text = Utils.maketext( 'bounce.txt', {'listname' : self.real_name, @@ -233,11 +233,10 @@ class Bouncer: 'did' : _('disabled'), 'but' : '', 'reenable' : '', - 'owneraddr': siteowner, + 'owneraddr': owneraddr, }, mlist=self) subject = _('Bounce action notification') - umsg = Message.UserNotification(self.GetOwnerEmail(), - siteowner, subject, + umsg = Message.UserNotification(owneraddr, owneraddr, subject, lang=self.preferred_language) # BAW: Be sure you set the type before trying to attach, or you'll get # a MultipartConversionError. -- cgit v1.2.3 From fc432afa375f34b935ab692619c1ba8bfb0e191a Mon Sep 17 00:00:00 2001 From: Jim Popovitch Date: Mon, 10 Oct 2016 21:47:57 +0000 Subject: Replaced UserNotification() with OwnerNotification() in two places, removed envsender override when processing owner emails (envsender was coded to use site-email, but to pass DMARC we need it to use the virtual domain) --- Mailman/Bouncer.py | 6 ++---- Mailman/Handlers/Hold.py | 3 +-- Mailman/Queue/MaildirRunner.py | 1 - 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/Mailman/Bouncer.py b/Mailman/Bouncer.py index 47955fa3..573b46e4 100644 --- a/Mailman/Bouncer.py +++ b/Mailman/Bouncer.py @@ -224,7 +224,6 @@ class Bouncer: # it was of dubious value). However, we'll provide empty, strange, or # meaningless strings for the unused %()s fields so that the language # translators don't have to provide new templates. - owneraddr = self.GetOwnerEmail() text = Utils.maketext( 'bounce.txt', {'listname' : self.real_name, @@ -233,11 +232,10 @@ class Bouncer: 'did' : _('disabled'), 'but' : '', 'reenable' : '', - 'owneraddr': owneraddr, + 'owneraddr': self.GetOwnerEmail(), }, mlist=self) subject = _('Bounce action notification') - umsg = Message.UserNotification(owneraddr, owneraddr, subject, - lang=self.preferred_language) + umsg = Message.OwnerNotification(self, subject, tomoderators=0) # BAW: Be sure you set the type before trying to attach, or you'll get # a MultipartConversionError. umsg.set_type('multipart/mixed') diff --git a/Mailman/Handlers/Hold.py b/Mailman/Handlers/Hold.py index 5452d06a..d0d22690 100644 --- a/Mailman/Handlers/Hold.py +++ b/Mailman/Handlers/Hold.py @@ -264,8 +264,7 @@ def hold_for_approval(mlist, msg, msgdata, exc): d['subject'] = usersubject # craft the admin notification message and deliver it subject = _('%(listname)s post from %(sender)s requires approval') - nmsg = Message.UserNotification(owneraddr, owneraddr, subject, - lang=lang) + nmsg = Message.OwnerNotification(mlist, subject, tomoderators=1) nmsg.set_type('multipart/mixed') text = MIMEText( Utils.maketext('postauth.txt', d, raw=1, mlist=mlist), diff --git a/Mailman/Queue/MaildirRunner.py b/Mailman/Queue/MaildirRunner.py index d9fe02cb..5959dcd6 100644 --- a/Mailman/Queue/MaildirRunner.py +++ b/Mailman/Queue/MaildirRunner.py @@ -172,7 +172,6 @@ class MaildirRunner(Runner): elif subq == 'owner': msgdata.update({ 'toowner': 1, - 'envsender': Utils.get_site_email(extra='bounces'), 'pipeline': mm_cfg.OWNER_PIPELINE, }) queue = get_switchboard(mm_cfg.INQUEUE_DIR) -- cgit v1.2.3 From 2fa8a893c410648ee86d28d379f717f2a83d0fd1 Mon Sep 17 00:00:00 2001 From: Jim Popovitch Date: Mon, 10 Oct 2016 22:11:22 +0000 Subject: fixed indentation in cron/mailpasswds --- cron/mailpasswds | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cron/mailpasswds b/cron/mailpasswds index 831e9ab0..db9c4875 100755 --- a/cron/mailpasswds +++ b/cron/mailpasswds @@ -141,9 +141,9 @@ def main(): for host in byhost.keys(): # Site owner is `mailman@dom.ain' userinfo = {} - virtlist = {} + virtlist = {} for mlist in byhost[host]: - virtlist = mlist + virtlist = mlist listaddr = mlist.GetListEmail() for member in mlist.getMembers(): # The user may have disabled reminders for this list -- cgit v1.2.3 From 8d98726fc0aa73ab8ab17822b4331e91162f722f Mon Sep 17 00:00:00 2001 From: Jim Popovitch Date: Tue, 11 Oct 2016 15:26:21 +0000 Subject: Further changes to keep domains aligned with virtual list notification emails --- Mailman/Cgi/create.py | 5 ++--- Mailman/Handlers/Moderate.py | 5 ++--- Mailman/ListAdmin.py | 12 ++++-------- Mailman/MTA/Manual.py | 12 ++++-------- 4 files changed, 12 insertions(+), 22 deletions(-) diff --git a/Mailman/Cgi/create.py b/Mailman/Cgi/create.py index dd862208..cac5a2e7 100644 --- a/Mailman/Cgi/create.py +++ b/Mailman/Cgi/create.py @@ -250,10 +250,9 @@ def process_request(doc, cgidata): 'requestaddr' : mlist.GetRequestEmail(), 'siteowner' : siteowner, }, mlist=mlist) - msg = Message.UserNotification( - owner, siteowner, + msg = Message.OwnerNotification(mlist, _('Your new mailing list: %(listname)s'), - text, mlist.preferred_language) + text=text, tomoderators=0) msg.send(mlist) # Success! diff --git a/Mailman/Handlers/Moderate.py b/Mailman/Handlers/Moderate.py index 199c97ac..f9e79cbe 100644 --- a/Mailman/Handlers/Moderate.py +++ b/Mailman/Handlers/Moderate.py @@ -174,10 +174,9 @@ def do_discard(mlist, msg): lang = mlist.preferred_language varhelp = '%s/?VARHELP=privacy/sender/discard_these_nonmembers' % \ mlist.GetScriptURL('admin', absolute=1) - nmsg = Message.UserNotification(mlist.GetOwnerEmail(), - mlist.GetBouncesEmail(), + nmsg = Message.OwnerNotification(mlist, _('Auto-discard notification'), - lang=lang) + lang=lang, tomoderators=0) nmsg.set_type('multipart/mixed') text = MIMEText(Utils.wrap(_( 'The attached message has been automatically discarded.')), diff --git a/Mailman/ListAdmin.py b/Mailman/ListAdmin.py index af579331..13502352 100755 --- a/Mailman/ListAdmin.py +++ b/Mailman/ListAdmin.py @@ -403,10 +403,8 @@ class ListAdmin: }, mlist=self) # This message should appear to come from the -owner so as # to avoid any useless bounce processing. - owneraddr = self.GetOwnerEmail() - msg = Message.UserNotification(owneraddr, owneraddr, subject, text, - self.preferred_language) - msg.send(self, **{'tomoderators': 1}) + msg = Message.OwnerNotification(self, subject, text=text, + tomoderators=1) # Restore the user's preferred language. i18n.set_language(lang) @@ -460,10 +458,8 @@ class ListAdmin: }, mlist=self) # This message should appear to come from the -owner so as # to avoid any useless bounce processing. - owneraddr = self.GetOwnerEmail() - msg = Message.UserNotification(owneraddr, owneraddr, subject, text, - self.preferred_language) - msg.send(self, **{'tomoderators': 1}) + msg = Message.OwnerNotification(self, subject, text=text, + tomoderators=1) def __handleunsubscription(self, record, value, comment): addr = record diff --git a/Mailman/MTA/Manual.py b/Mailman/MTA/Manual.py index 92e1c03c..46adfae2 100644 --- a/Mailman/MTA/Manual.py +++ b/Mailman/MTA/Manual.py @@ -94,10 +94,9 @@ equivalent) file by adding the following lines, and possibly running the # 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, + msg = Message.OwnerNotification(mlist, _('Mailing list creation request for list %(listname)s'), - sfp.getvalue(), mm_cfg.DEFAULT_SERVER_LANGUAGE) + sfp.getvalue()) msg.send(mlist) @@ -135,12 +134,9 @@ equivalent) file by removing the following lines, and possibly running the 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, + msg = Message.OwnerNotification(mlist, _('Mailing list removal request for list %(listname)s'), - sfp.getvalue(), mm_cfg.DEFAULT_SERVER_LANGUAGE) + sfp.getvalue()) msg['Date'] = email.Utils.formatdate(localtime=1) outq = get_switchboard(mm_cfg.OUTQUEUE_DIR) outq.enqueue(msg, recips=[siteowner], nodecorate=1) -- cgit v1.2.3 From 17cc3dae404831d29c1d8ea4794105cdbbe3bbb7 Mon Sep 17 00:00:00 2001 From: Jim Popovitch Date: Wed, 12 Oct 2016 14:38:43 +0000 Subject: OwnerNotification needs to explictly set msg.envsender rather than relying on the downstream pipeline to get it right (too often it gets it wrong and sets Sender to sitelist domain) --- Mailman/Message.py | 1 + 1 file changed, 1 insertion(+) diff --git a/Mailman/Message.py b/Mailman/Message.py index 24c15a84..609786a2 100644 --- a/Mailman/Message.py +++ b/Mailman/Message.py @@ -318,6 +318,7 @@ class OwnerNotification(UserNotification): del self['to'] self['To'] = mlist.GetOwnerEmail() self._sender = sender + self.envsender = sender def _enqueue(self, mlist, **_kws): # Not imported at module scope to avoid import loop -- cgit v1.2.3 From f381505907c2a810835a711c8b4e19d10092a069 Mon Sep 17 00:00:00 2001 From: Jim Popovitch Date: Wed, 19 Oct 2016 04:07:14 +0000 Subject: force OwnerNotification to use mlist.getListAddress('bounces') --- Mailman/Message.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mailman/Message.py b/Mailman/Message.py index 609786a2..0edc3c31 100644 --- a/Mailman/Message.py +++ b/Mailman/Message.py @@ -311,7 +311,7 @@ class OwnerNotification(UserNotification): 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') + sender = mlist.getListAddress('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 -- cgit v1.2.3