diff --git a/hypha/apply/users/tests/test_utils.py b/hypha/apply/users/tests/test_utils.py
index 95245b41a2164c6a0ca6cae9680ff501d2c16d2e..7c490bb03397f5f97fc62fe8558120b52c445aaf 100644
--- a/hypha/apply/users/tests/test_utils.py
+++ b/hypha/apply/users/tests/test_utils.py
@@ -1,5 +1,3 @@
-from test.support import EnvironmentVarGuard
-
 from django.core import mail
 from django.test import TestCase, override_settings
 
@@ -10,12 +8,9 @@ from ..utils import send_activation_email
 
 @override_settings(ROOT_URLCONF='hypha.apply.urls')
 class TestActivationEmail(TestCase):
-    def setUp(self) -> None:
-        self.env = EnvironmentVarGuard()
-        self.env.set('PRIMARY_HOST', 'primary-domain.org')
 
     def test_activation_email_includes_link(self):
-        with self.env:
-            send_activation_email(UserFactory())
-            assert len(mail.outbox) == 1
-            assert "password reset form at https://primary-domain.org" in mail.outbox[0]
+        send_activation_email(UserFactory())
+        assert len(mail.outbox) == 1
+        email_body = mail.outbox[0].body
+        assert "password reset form at: https://primary-test-host.org" in email_body
diff --git a/hypha/settings/base.py b/hypha/settings/base.py
index 6bd4255830a348abb7f259b98eadb11765006478..0e3f129a4c4a804af72d3ddec6c48d731d843982 100644
--- a/hypha/settings/base.py
+++ b/hypha/settings/base.py
@@ -587,10 +587,9 @@ if env.bool('BASIC_AUTH_ENABLED', False):
     BASIC_AUTH_WHITELISTED_IP_NETWORKS = env.list('BASIC_AUTH_WHITELISTED_IP_NETWORKS', [])
 
 
-if env.str('PRIMARY_HOST', None):
-    # This is used by Wagtail's email notifications for constructing absolute
-    # URLs.
-    WAGTAILADMIN_BASE_URL = 'https://{}'.format(env.str('PRIMARY_HOST'))
+# This is used by Wagtail's email notifications for constructing absolute URLs.
+PRIMARY_HOST = env.str('PRIMARY_HOST', None)
+WAGTAILADMIN_BASE_URL = env.str("WAGTAILADMIN_BASE_URL", None) or f'https://{PRIMARY_HOST}' if PRIMARY_HOST else None
 
 
 # Security configuration
diff --git a/hypha/settings/test.py b/hypha/settings/test.py
index 6cd3f6faecb3d351166975c27309136bf29960b8..7e3a944ccf7ca37e377d66ce1cacd8aab4b6f6fd 100644
--- a/hypha/settings/test.py
+++ b/hypha/settings/test.py
@@ -23,4 +23,4 @@ PASSWORD_HASHERS = [
     'django.contrib.auth.hashers.MD5PasswordHasher',
 ]
 
-WAGTAILADMIN_BASE_URL = 'http://base-admin-url/'
+WAGTAILADMIN_BASE_URL = "https://primary-test-host.org"