diff --git a/src/regtech_mail_api/api.py b/src/regtech_mail_api/api.py index d89b973..8ca8a40 100644 --- a/src/regtech_mail_api/api.py +++ b/src/regtech_mail_api/api.py @@ -65,7 +65,14 @@ async def send_email(request: Request): sender_addr = request.user.email sender_name = request.user.name if request.user.name else "" type = request.headers["case-type"] - subject = f"[DEV BETA] SBL User Request for {type}" + + header = "[BETA]" + if "cfpb" in sender_addr.lower().split("@")[-1]: + header = "[CFPB BETA]" + if settings.environment: + header = f"[{settings.environment}]" + + subject = f"{header} SBL User Request for {type}" form_data = await request.form() diff --git a/src/regtech_mail_api/settings.py b/src/regtech_mail_api/settings.py index aae6367..e8e47a6 100644 --- a/src/regtech_mail_api/settings.py +++ b/src/regtech_mail_api/settings.py @@ -11,6 +11,7 @@ class EmailMailerType(str, Enum): class EmailApiSettings(BaseSettings): + environment: str = "" email_mailer: EmailMailerType = EmailMailerType.SMTP smtp_host: str | None = None smtp_port: int = 0 diff --git a/tests/test_send.py b/tests/test_send.py index 3a3f987..4a96b4c 100644 --- a/tests/test_send.py +++ b/tests/test_send.py @@ -57,7 +57,7 @@ def test_send_no_profile( ): email_json = { "email": { - "subject": "[DEV BETA] SBL User Request for Institution Profile Change", + "subject": "[CFPB BETA] SBL User Request for Institution Profile Change", "body": "Contact Email: test@cfpb.gov\nContact Name: \n\nlei: 1234567890ABCDEFGHIJ\ninstitution_name_1: Fintech 1\ntin_1: 12-3456789\nrssd_1: 1234567", "from_addr": "test@cfpb.gov", "to": ["cases@localhost.localdomain"], @@ -87,7 +87,7 @@ def test_send( ): email_json = { "email": { - "subject": "[DEV BETA] SBL User Request for Institution Profile Change", + "subject": "[CFPB BETA] SBL User Request for Institution Profile Change", "body": "Contact Email: test@cfpb.gov\nContact Name: Test User\n\nlei: 1234567890ABCDEFGHIJ\ninstitution_name_1: Fintech 1\ntin_1: 12-3456789\nrssd_1: 1234567", "from_addr": "test@cfpb.gov", "to": ["cases@localhost.localdomain"],