Removes the optional 'from_email' argument from the send_email helper function, because we are now always sending email from the default MIT email address (specifically the EMAIL_FROM_ADDRESS in project settings).
In cases where we were sending email "from" a lab email address, this PR adds the lab email to the "reply-to" email header.
A few implementation notes:
The reply-to must be a list or tuple, hence the square brackets around the lab email address in the reply-to argument.
I didn't need to modify every send_mail call in the codebase because the 'from_email' argument was optional, and when omitted, it defaulted to sending from the project's default 'from' address.
The send_mail function is mocked in exp/tests/test_contact_views.py, so there we're just checking that the mocked function wasn't called with the "from_email" argument.
There's a new test in studies/tests.py called test_no_custom_from_address that I think does a better job of testing that any 'from_email' arguments that are passed to send_mail will be ignored, and mail will only be sent from the project's 'from' address.
Fixes #1356
This PR does two key things:
send_email
helper function, because we are now always sending email from the default MIT email address (specifically theEMAIL_FROM_ADDRESS
in project settings).A few implementation notes:
send_mail
call in the codebase because the 'from_email' argument was optional, and when omitted, it defaulted to sending from the project's default 'from' address.send_mail
function is mocked inexp/tests/test_contact_views.py
, so there we're just checking that the mocked function wasn't called with the "from_email" argument.studies/tests.py
calledtest_no_custom_from_address
that I think does a better job of testing that any 'from_email' arguments that are passed tosend_mail
will be ignored, and mail will only be sent from the project's 'from' address.