Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core


Commits:
7872b511 by Mark Sapiro at 2020-07-13T21:41:41-07:00
Enable sending bounce probe to a member subscribed as a User.

- - - - -
bbc96f7f by Mark Sapiro at 2020-07-14T05:01:25+00:00
Merge branch 'fix_739' into 'master'

Enable sending bounce probe to a member subscribed as a User.

Closes #739

See merge request mailman/mailman!669
- - - - -


3 changed files:

- src/mailman/app/bounces.py
- src/mailman/app/tests/test_bounces.py
- src/mailman/docs/NEWS.rst


Changes:

=====================================
src/mailman/app/bounces.py
=====================================
@@ -199,7 +199,7 @@ def send_probe(member, msg=None, message_id=None):
         code=member.preferred_language.code,
         )
     text = wrap(expand(template, mlist, dict(
-        sender_email=member.subscriber.email,
+        sender_email=member.address.email,
         # For backward compatibility.
         address=member.address.email,
         email=member.address.email,


=====================================
src/mailman/app/tests/test_bounces.py
=====================================
@@ -36,6 +36,7 @@ from mailman.testing.helpers import (
     LogFileMark, get_queue_messages, specialized_message_from_string as mfs,
     subscribe)
 from mailman.testing.layers import ConfigLayer
+from mailman.utilities.datetime import now
 from zope.component import getUtility
 
 
@@ -274,6 +275,22 @@ list owner at
         self.assertEqual(message['to'], 'a...@example.com')
         self.assertEqual(message['subject'], 'Test mailing list probe message')
 
+    def test_send_probe_to_user(self):
+        # Can we send probe to member subscribed as a user.
+        user_manager = getUtility(IUserManager)
+        anne = user_manager.get_user('a...@example.com')
+        anne_address = user_manager.get_address('a...@example.com')
+        anne_address.verified_on = now()
+        anne.preferred_address = anne_address
+        self._member = self._mlist.subscribe(anne, send_welcome_message=False)
+        token = send_probe(self._member, self._msg)
+        items = get_queue_messages('virgin', expected_count=1)
+        message = items[0].msg
+        self.assertEqual(message['from'],
+                         'test-bounces+{0}@example.com'.format(token))
+        self.assertEqual(message['to'], 'a...@example.com')
+        self.assertEqual(message['subject'], 'Test mailing list probe message')
+
     def test_no_precedence_header(self):
         # Probe messages should not have a Precedence header (LP: #808821).
         send_probe(self._member, self._msg)


=====================================
src/mailman/docs/NEWS.rst
=====================================
@@ -25,6 +25,8 @@ Bugs
   case.  (Closes #726)
 * Fixed ``mailman.email.message.Message.as_string`` to not return unicode
   surrogates.  (Closes #732)
+* Bounce probes can now be sent to a member subscribed as a User.
+  (Closes #739)
 
 Command line
 ------------



View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/e405f471815feb7513a404ee3cfac8d98c80869a...bbc96f7fd56a9e89ffd2cdcd6aba3ccbc19237a0

-- 
View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/e405f471815feb7513a404ee3cfac8d98c80869a...bbc96f7fd56a9e89ffd2cdcd6aba3ccbc19237a0
You're receiving this email because of your account on gitlab.com.


_______________________________________________
Mailman-checkins mailing list -- mailman-checkins@python.org
To unsubscribe send an email to mailman-checkins-le...@python.org
https://mail.python.org/mailman3/lists/mailman-checkins.python.org/
Member address: arch...@jab.org

Reply via email to