From d7f855106fa7887c21985b9b8ae076bef8927c2c Mon Sep 17 00:00:00 2001 From: James Frost Date: Tue, 10 Feb 2026 14:04:57 +0000 Subject: [PATCH] No longer set sender in mail command It doesn't work on the current Met Office system, and complains in the logs. --- src/CSET/cset_workflow/app/send_email/bin/send_email.py | 2 +- tests/workflow_utils/test_send_email.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/CSET/cset_workflow/app/send_email/bin/send_email.py b/src/CSET/cset_workflow/app/send_email/bin/send_email.py index c59dc634a..a65d22f72 100755 --- a/src/CSET/cset_workflow/app/send_email/bin/send_email.py +++ b/src/CSET/cset_workflow/app/send_email/bin/send_email.py @@ -52,7 +52,7 @@ def run(): except ValueError: body = "The webpage for your run of CSET is now ready, though the address could not be determined.\nCheck that WEB_ADDR and WEB_DIR are set correctly, then consider filing a bug report at https://github.com/MetOffice/CSET" subprocess.run( - f'printf "{body}" | mail -s "{subject}" -S "from=notifications" "$USER"', + f'printf "{body}" | mail -s "{subject}" "$USER"', check=True, shell=True, ) diff --git a/tests/workflow_utils/test_send_email.py b/tests/workflow_utils/test_send_email.py index 02a408be3..3e25df0a1 100644 --- a/tests/workflow_utils/test_send_email.py +++ b/tests/workflow_utils/test_send_email.py @@ -69,7 +69,7 @@ def test_send_email(monkeypatch): def mock_subprocess_run(args, check, shell): assert ( args - == 'printf "The webpage for your run of CSET is now ready. You can view it here:\nhttps://example.com/~user/CSET" | mail -s "CSET webpage ready" -S "from=notifications" "$USER"' + == 'printf "The webpage for your run of CSET is now ready. You can view it here:\nhttps://example.com/~user/CSET" | mail -s "CSET webpage ready" "$USER"' ) assert check assert shell @@ -84,7 +84,7 @@ def test_send_email_invalid_environment_variables(monkeypatch): def mock_subprocess_run(args, check, shell): assert ( args - == 'printf "The webpage for your run of CSET is now ready, though the address could not be determined.\nCheck that WEB_ADDR and WEB_DIR are set correctly, then consider filing a bug report at https://github.com/MetOffice/CSET" | mail -s "CSET webpage ready" -S "from=notifications" "$USER"' + == 'printf "The webpage for your run of CSET is now ready, though the address could not be determined.\nCheck that WEB_ADDR and WEB_DIR are set correctly, then consider filing a bug report at https://github.com/MetOffice/CSET" | mail -s "CSET webpage ready" "$USER"' ) assert check assert shell