Skip to content

Commit

Permalink
Introduce configuration option for status email recipient
Browse files Browse the repository at this point in the history
The previously existing configuation option c3smembership.mailaddr is renamed
to c3smembership.notification_sender. The notification sender email address is
used for sending emails like the email address confirmation link, the
membership certificate and dues invoices.

The status receiver email address option c3smembership.status_receiver is used
as a recipient for status emails send by the membership application like the
new application email which informs the staff that a new application was
submitted.
  • Loading branch information
mrkslrnz committed Sep 10, 2018
1 parent f53f0e6 commit 6feaea0
Show file tree
Hide file tree
Showing 27 changed files with 146 additions and 69 deletions.
18 changes: 18 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
Next Release
============


Introduce configuration value for status email recipient.

- The previously existing configuation option c3smembership.mailaddr is
renamed to c3smembership.notification_sender. The notification sender email
address is used for sending emails like the email address confirmation
link, the membership certificate and dues invoices.

- The status receiver email address option c3smembership.status_receiver is
used as a recipient for status emails send by the membership application
like the new application email which informs the staff that a new
application was submitted.



1.24.1
======

Expand Down
3 changes: 2 additions & 1 deletion c3smembership/business/membership_application.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,8 @@ def mail_signature_confirmation(self, member_id, request):
email_subject, email_body = _make_signature_confirmation_email(member)
message = Message(
subject=email_subject,
sender=request.registry.settings['c3smembership.mailaddr'],
sender=request.registry.settings[
'c3smembership.notification_sender'],
recipients=[member.email],
body=email_body
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ def test_mail_signature_confirmation(self):

pyramid_request_mock = mock.Mock()
pyramid_request_mock.registry.settings = {
'c3smembership.mailaddr': '[email protected]'}
'c3smembership.notification_sender': '[email protected]'}

membership_application.mail_signature_confirmation(
'member id',
Expand Down
9 changes: 6 additions & 3 deletions c3smembership/presentation/views/dues_2015.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,8 @@ def send_dues15_invoice_email(request, m_id=None):
start_quarter)
message = Message(
subject=email_subject,
sender=request.registry.settings['c3smembership.mailaddr'],
sender=request.registry.settings[
'c3smembership.notification_sender'],
recipients=[member.email],
body=email_body,
)
Expand All @@ -270,7 +271,8 @@ def send_dues15_invoice_email(request, m_id=None):
make_dues_invoice_investing_email(member)
message = Message(
subject=email_subject,
sender=request.registry.settings['c3smembership.mailaddr'],
sender=request.registry.settings[
'c3smembership.notification_sender'],
recipients=[member.email],
body=email_body,
)
Expand Down Expand Up @@ -734,7 +736,8 @@ def dues15_reduction(request):

message = Message(
subject=email_subject,
sender=request.registry.settings['c3smembership.mailaddr'],
sender=request.registry.settings[
'c3smembership.notification_sender'],
recipients=[member.email],
body=email_body,
)
Expand Down
9 changes: 6 additions & 3 deletions c3smembership/presentation/views/dues_2016.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,8 @@ def send_dues16_invoice_email(request, m_id=None):
start_quarter)
message = Message(
subject=email_subject,
sender=request.registry.settings['c3smembership.mailaddr'],
sender=request.registry.settings[
'c3smembership.notification_sender'],
recipients=[member.email],
body=email_body,
)
Expand All @@ -273,7 +274,8 @@ def send_dues16_invoice_email(request, m_id=None):
make_dues_invoice_investing_email(member)
message = Message(
subject=email_subject,
sender=request.registry.settings['c3smembership.mailaddr'],
sender=request.registry.settings[
'c3smembership.notification_sender'],
recipients=[member.email],
body=email_body,
)
Expand Down Expand Up @@ -791,7 +793,8 @@ def dues16_reduction(request):

message = Message(
subject=email_subject,
sender=request.registry.settings['c3smembership.mailaddr'],
sender=request.registry.settings[
'c3smembership.notification_sender'],
recipients=[member.email],
body=email_body,
)
Expand Down
9 changes: 6 additions & 3 deletions c3smembership/presentation/views/dues_2017.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,8 @@ def send_dues17_invoice_email(request, m_id=None):
start_quarter)
message = Message(
subject=email_subject,
sender=request.registry.settings['c3smembership.mailaddr'],
sender=request.registry.settings[
'c3smembership.notification_sender'],
recipients=[member.email],
body=email_body,
)
Expand All @@ -280,7 +281,8 @@ def send_dues17_invoice_email(request, m_id=None):
make_dues_invoice_investing_email(member)
message = Message(
subject=email_subject,
sender=request.registry.settings['c3smembership.mailaddr'],
sender=request.registry.settings[
'c3smembership.notification_sender'],
recipients=[member.email],
body=email_body,
)
Expand Down Expand Up @@ -801,7 +803,8 @@ def dues17_reduction(request):

message = Message(
subject=email_subject,
sender=request.registry.settings['c3smembership.mailaddr'],
sender=request.registry.settings[
'c3smembership.notification_sender'],
recipients=[member.email],
body=email_body,
)
Expand Down
9 changes: 6 additions & 3 deletions c3smembership/presentation/views/dues_2018.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,8 @@ def send_dues18_invoice_email(request, m_id=None):
start_quarter)
message = Message(
subject=email_subject,
sender=request.registry.settings['c3smembership.mailaddr'],
sender=request.registry.settings[
'c3smembership.notification_sender'],
recipients=[member.email],
body=email_body,
)
Expand All @@ -298,7 +299,8 @@ def send_dues18_invoice_email(request, m_id=None):
make_dues_invoice_investing_email(member)
message = Message(
subject=email_subject,
sender=request.registry.settings['c3smembership.mailaddr'],
sender=request.registry.settings[
'c3smembership.notification_sender'],
recipients=[member.email],
body=email_body,
)
Expand Down Expand Up @@ -795,7 +797,8 @@ def dues18_reduction(request):

message = Message(
subject=email_subject,
sender=request.registry.settings['c3smembership.mailaddr'],
sender=request.registry.settings[
'c3smembership.notification_sender'],
recipients=[member.email],
body=email_body,
)
Expand Down
5 changes: 3 additions & 2 deletions c3smembership/presentation/views/general_assembly.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ def invite_member_bcgv(request):
email_subject, email_body = make_bcga18_invitation_email(member, url)
message = Message(
subject=email_subject,
sender=request.registry.settings['c3smembership.mailaddr'],
sender=request.registry.settings['c3smembership.notification_sender'],
recipients=[member.email],
body=email_body,
)
Expand Down Expand Up @@ -204,7 +204,8 @@ def batch_invite(request):
email_subject, email_body = make_bcga18_invitation_email(member, url)
message = Message(
subject=email_subject,
sender=request.registry.settings['c3smembership.mailaddr'],
sender=request.registry.settings[
'c3smembership.notification_sender'],
recipients=[member.email],
body=email_body,
)
Expand Down
2 changes: 1 addition & 1 deletion c3smembership/presentation/views/join.py
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,7 @@ def make_random_string():
send_mail_confirmation_mail(
member,
request.registry.settings['c3smembership.url'],
request.registry.settings['c3smembership.mailaddr'],
request.registry.settings['c3smembership.notification_sender'],
request.registry.get_mailer(request),
request.localizer,
request.registry.settings['testing.mail_to_console'])
Expand Down
8 changes: 4 additions & 4 deletions c3smembership/presentation/views/membership_acquisition.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ def mail_payment_confirmation(request):
email_subject, email_body = make_payment_confirmation_email(member)
message = Message(
subject=email_subject,
sender=request.registry.settings['c3smembership.mailaddr'],
sender=request.registry.settings['c3smembership.notification_sender'],
recipients=[member.email],
body=email_body,
)
Expand Down Expand Up @@ -339,7 +339,7 @@ def mail_signature_reminder(request):
email_subject, email_body = make_signature_reminder_email(member)
message = Message(
subject=email_subject,
sender=request.registry.settings['c3smembership.mailaddr'],
sender=request.registry.settings['c3smembership.notification_sender'],
recipients=[member.email],
body=email_body
)
Expand Down Expand Up @@ -380,7 +380,7 @@ def mail_payment_reminder(request):
email_subject, email_body = make_payment_reminder_email(member)
message = Message(
subject=email_subject,
sender=request.registry.settings['c3smembership.mailaddr'],
sender=request.registry.settings['c3smembership.notification_sender'],
recipients=[member.email],
body=email_body
)
Expand Down Expand Up @@ -420,7 +420,7 @@ def mail_mail_conf(request):
send_mail_confirmation_mail(
member,
request.registry.settings['c3smembership.url'],
request.registry.settings['c3smembership.mailaddr'],
request.registry.settings['c3smembership.notification_sender'],
request.registry.get_mailer(request),
request.localizer,
request.registry.settings['testing.mail_to_console'])
Expand Down
2 changes: 1 addition & 1 deletion c3smembership/presentation/views/membership_certificate.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def send_certificate_email(request):

the_message = Message(
subject=email_subject,
sender=request.registry.settings['c3smembership.mailaddr'],
sender=request.registry.settings['c3smembership.notification_sender'],
recipients=[member.email],
body=email_body
)
Expand Down
21 changes: 12 additions & 9 deletions c3smembership/presentation/views/staff.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,10 @@ class Staffer(colander.MappingSchema):
authenticated_userid(request)))
message = Message(
subject='[C3S Yes] staff was deleted.',
sender=request.registry.settings['c3smembership.mailaddr'],
recipients=[
request.registry.settings['c3smembership.mailaddr']],
sender=request.registry.settings[
'c3smembership.notification_sender'],
recipients=[request.registry.settings[
'c3smembership.status_receiver']],
body=encrypted
)
mailer = get_mailer(request)
Expand Down Expand Up @@ -115,9 +116,10 @@ class Staffer(colander.MappingSchema):
authenticated_userid(request)))
message = Message(
subject='[C3S Yes] staff password changed.',
sender=request.registry.settings['c3smembership.mailaddr'],
recipients=[
request.registry.settings['c3smembership.mailaddr']],
sender=request.registry.settings[
'c3smembership.notification_sender'],
recipients=[request.registry.settings[
'c3smembership.status_receiver']],
body=encrypted
)

Expand All @@ -139,9 +141,10 @@ class Staffer(colander.MappingSchema):
authenticated_userid(request)))
message = Message(
subject='[C3S Yes] staff was added.',
sender=request.registry.settings['c3smembership.mailaddr'],
recipients=[
request.registry.settings['c3smembership.mailaddr']],
sender=request.registry.settings[
'c3smembership.notification_sender'],
recipients=[request.registry.settings[
'c3smembership.status_receiver']],
body=encrypted
)
mailer = get_mailer(request)
Expand Down
2 changes: 1 addition & 1 deletion c3smembership/tests/test_general_assembly.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ def setUp(self):
self.config.registry.settings['c3smembership.url'] = 'http://foo.com'
self.config.registry.settings['ticketing.url'] = 'http://bar.com'
self.config.registry.settings['testing.mail_to_console'] = 'false'
self.config.registry.settings['c3smembership.mailaddr'] = \
self.config.registry.settings['c3smembership.notification_sender'] = \
'[email protected]'
self.session = init_testing_db()

Expand Down
5 changes: 4 additions & 1 deletion c3smembership/tests/test_join.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,10 @@ def setUp(self):
self.config.include('pyramid_mailer.testing')
self.config.registry.settings[
'c3smembership.url'] = 'https://yes.c3s.cc'
self.config.registry.settings['c3smembership.mailaddr'] = '[email protected]'
self.config.registry.settings['c3smembership.notification_sender'] = \
'[email protected]'
self.config.registry.settings['c3smembership.status_receiver'] = \
'[email protected]'
self.config.registry.settings['testing.mail_to_console'] = 'false'
self.config.registry.get_mailer = get_mailer

Expand Down
2 changes: 1 addition & 1 deletion c3smembership/tests/test_mail_mail_confirmation.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def setUp(self):
self.config = testing.setUp()
self.config.include('pyramid_mailer.testing')
self.config.registry.settings['c3smembership.url'] = 'http://foo.com'
self.config.registry.settings['c3smembership.mailaddr'] = \
self.config.registry.settings['c3smembership.notification_sender'] = \
'[email protected]'
self.config.registry.settings['testing.mail_to_console'] = 'false'
self.config.registry.get_mailer = get_mailer
Expand Down
2 changes: 1 addition & 1 deletion c3smembership/tests/test_membership_acquisition.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def setUp(self):
self.config.include('pyramid_mailer.testing')
self.config.include('c3smembership.presentation.pagination')
self.config.registry.settings['testing.mail_to_console'] = 'false'
self.config.registry.settings['c3smembership.mailaddr'] = \
self.config.registry.settings['c3smembership.notification_sender'] = \
'[email protected]'
self.config.add_route('dashboard', '/')
def dashboard_content_size_provider(filtering):
Expand Down
3 changes: 2 additions & 1 deletion c3smembership/tests/test_membership_application.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ def setUp(self):
'sqlalchemy.url': 'sqlite:///:memory:',
'api_auth_token': u"SECRETAUTHTOKEN",
'c3smembership.url': u'localhost',
'c3smembership.mailaddr': u'[email protected]',
'c3smembership.notification_sender': u'[email protected]',
'c3smembership.status_receiver': u'[email protected]',
'testing.mail_to_console': u'false',
}
self.config = testing.setUp()
Expand Down
2 changes: 1 addition & 1 deletion c3smembership/tests/test_membership_certificate.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def setUp(self):
DBSession.remove()
self.session = _initTestingDB()
self.config.registry.settings['testing.mail_to_console'] = 'no'
self.config.registry.settings['c3smembership.mailaddr'] = \
self.config.registry.settings['c3smembership.notification_sender'] = \
'[email protected]'
# set this to true to see mail bodies, but:
# tests will fail: no mail in outbox
Expand Down
2 changes: 1 addition & 1 deletion c3smembership/tests/test_membership_dues_2015.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ def setUp(self):
self.config.include('pyramid_mailer.testing')
self.config.registry.settings[
'c3smembership.url'] = 'https://yes.c3s.cc'
self.config.registry.settings['c3smembership.mailaddr'] = \
self.config.registry.settings['c3smembership.notification_sender'] = \
'[email protected]'
self.config.registry.settings['testing.mail_to_console'] = 'false'

Expand Down
3 changes: 2 additions & 1 deletion c3smembership/tests/test_membership_dues_2016.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,8 @@ def setUp(self):
self.config.include('pyramid_mailer.testing')
self.config.registry.settings[
'c3smembership.url'] = 'https://yes.c3s.cc'
self.config.registry.settings['c3smembership.mailaddr'] = '[email protected]'
self.config.registry.settings['c3smembership.notification_sender'] = \
'[email protected]'
self.config.registry.settings['testing.mail_to_console'] = 'false'

DBSession.remove()
Expand Down
3 changes: 2 additions & 1 deletion c3smembership/tests/test_membership_dues_2017.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,8 @@ def setUp(self):
self.config.include('pyramid_mailer.testing')
self.config.registry.settings[
'c3smembership.url'] = 'https://yes.c3s.cc'
self.config.registry.settings['c3smembership.mailaddr'] = '[email protected]'
self.config.registry.settings['c3smembership.notification_sender'] = \
'[email protected]'
self.config.registry.settings['testing.mail_to_console'] = 'false'

DBSession.remove()
Expand Down
3 changes: 2 additions & 1 deletion c3smembership/tests/test_membership_dues_2018.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,8 @@ def setUp(self):
self.config.include('pyramid_mailer.testing')
self.config.registry.settings[
'c3smembership.url'] = 'https://yes.c3s.cc'
self.config.registry.settings['c3smembership.mailaddr'] = '[email protected]'
self.config.registry.settings['c3smembership.notification_sender'] = \
'[email protected]'
self.config.registry.settings['testing.mail_to_console'] = 'false'

DBSession.remove()
Expand Down
2 changes: 1 addition & 1 deletion c3smembership/tests/test_webtest.py
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,7 @@ def setUp(self):
# 'sqlalchemy.url': 'sqlite:///test_webtest_functional.db',
'sqlalchemy.url': 'sqlite:///:memory:',
'available_languages': 'da de en es fr',
'c3smembership.mailaddr': '[email protected]',
'c3smembership.notification_sender': '[email protected]',
'testing.mail_to_console': 'false'}
engine = engine_from_config(my_settings)
DBSession.configure(bind=engine)
Expand Down
Loading

0 comments on commit 6feaea0

Please sign in to comment.