billing: Use no-reply address as from_address in sponsorship emails.

This commit is contained in:
Vishnu KS 2020-07-14 11:47:00 +05:30 committed by Tim Abbott
parent e22885a6bf
commit 108ad84944
2 changed files with 5 additions and 3 deletions

View File

@ -1092,7 +1092,8 @@ class StripeTest(StripeTestCase):
self.assertEqual(len(message.to), 1) self.assertEqual(len(message.to), 1)
self.assertEqual(message.to[0], "desdemona+admin@zulip.com") self.assertEqual(message.to[0], "desdemona+admin@zulip.com")
self.assertEqual(message.subject, "Sponsorship request (Open-source) for zulip") self.assertEqual(message.subject, "Sponsorship request (Open-source) for zulip")
self.assertEqual(message.from_email, f'{user.full_name} <{user.delivery_email}>') self.assertEqual(message.reply_to, ['hamlet@zulip.com'])
self.assertIn('Zulip sponsorship <noreply-', message.from_email)
self.assertIn("User role: Member", message.body) self.assertIn("User role: Member", message.body)
self.assertIn("Support URL: http://zulip.testserver/activity/support?q=zulip", message.body) self.assertIn("Support URL: http://zulip.testserver/activity/support?q=zulip", message.body)
self.assertIn("Website: https://infinispan.org", message.body) self.assertIn("Website: https://infinispan.org", message.body)

View File

@ -217,8 +217,9 @@ def sponsorship(request: HttpRequest, user: UserProfile,
send_email( send_email(
"zerver/emails/sponsorship_request", "zerver/emails/sponsorship_request",
to_emails=[FromAddress.SUPPORT], to_emails=[FromAddress.SUPPORT],
from_name=user.full_name, from_name="Zulip sponsorship",
from_address=user.delivery_email, from_address=FromAddress.tokenized_no_reply_address(),
reply_to_email=user.delivery_email,
context=context, context=context,
) )