Skip to content

Feat/ses enrollment email templates#259

Draft
nthriveni-sonata-ship-it wants to merge 5 commits into
edx:release-ulmofrom
nthriveni-sonata-ship-it:feat/ses-enrollment-email-templates
Draft

Feat/ses enrollment email templates#259
nthriveni-sonata-ship-it wants to merge 5 commits into
edx:release-ulmofrom
nthriveni-sonata-ship-it:feat/ses-enrollment-email-templates

Conversation

@nthriveni-sonata-ship-it

@nthriveni-sonata-ship-it nthriveni-sonata-ship-it commented May 4, 2026

Copy link
Copy Markdown
Member

Title: feat: migrate course enrollment emails from Braze to SES

Description: ## Summary

Adds SES-based enrollment email path behind waffle flag.
Keeps Braze path as fallback with retry behavior.
Supports language-specific templates (English and Spanish).
Prefers theme-based templates via SES_ENROLLMENT_EMAIL_THEME with platform template fallback.
Adds manual validation command for local and post-deploy verification.
Adds test coverage for routing, fallback, retry, and language behavior

Validation done

Manual command checks in devstack:
test-template-rendering
test-language-selection
test-image-urls
send-test-email

Fallback-focused automated tests:
ses_failure_falls_back_to_braze
ses_and_braze_fallback_failure_triggers_retry
braze_path_used_when_waffle_disabled
braze_path_retries_when_canvas_id_missing
ses_fallback_retries_when_canvas_id_missing

Notes
Devstack testing-only settings were kept commented where appropriate.
Repository: edx/edx-platform

At-a-Glance Overview

USER ENROLLMENT
    ↓
[Celery Task] send_course_enrollment_email()
    ↓
[Waffle Flag] student.enable_ses_for_course_enrollment?
    ├─ YES → SES PATH (new)
    └─ NO  → BRAZE PATH (existing)

SES PATH:
├─ 1. Select Language: 'en' or 'es'
├─ 2. Load Template: edx-themes (preferred) or edx-platform (fallback)
├─ 3. Build Image URLs: Relative → Absolute
├─ 4. Render Template: With context
├─ 5. Send via SES: AWS SES (us-east-1)
│   ├─ SUCCESS → Done ✅
│   └─ ERROR → Fallback to Braze
│
└─ BRAZE FALLBACK (if SES fails):
   ├─ Send via Braze canvas
   ├─ SUCCESS → Done ✅
   └─ ERROR → Retry (max 3 times, exponential backoff)

EMAIL DELIVERED

**Testing**
1. Local devstack validation
Verified theme-first template resolution and fallback behavior in LMS runtime.
Verified language selection for English and Spanish.
Verified image URL generation for SES templates.
Verified manual send path in local file email backend.


2. Theme-first and fallback proof
Confirmed when theme templates exist, enrollment templates resolve from edx-themes path.
Confirmed when theme enrollment templates are temporarily unavailable, rendering falls back to platform templates under common student email templates.
Restored theme templates and re-verified theme path resolution.

3. Braze fallback and retry behavior
Ran fallback-focused tests after final tasks.py updates.
Confirmed SES failure path falls back to Braze and retry behavior remains intact.
Result: 5 fallback-focused tests passed.


4. Full routing test class
Executed full SES routing test class for end-to-end routing coverage.
Result: all tests in TestCourseEnrollmentEmailSESRouting passed locally in container.


5. Stage and production configuration checks
Verified stage and production remote config(edx-internal) contain:
SES_ENROLLMENT_EMAIL_THEME set to edx.org-next

This ensures theme-first loading is enabled in deployed environments, with platform fallback still available.

6. Safety checks
Waffle-flag controlled rollout preserved.
Braze fallback preserved when SES path fails.
No duplicate-send behavior preserved.
Platform templates remain as fallback only.



@nthriveni-sonata-ship-it nthriveni-sonata-ship-it force-pushed the feat/ses-enrollment-email-templates branch from 7c24e49 to 3c10a22 Compare May 15, 2026 08:04
@nthriveni-sonata-ship-it nthriveni-sonata-ship-it force-pushed the feat/ses-enrollment-email-templates branch from 3c10a22 to d51c9dd Compare May 15, 2026 08:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant