Files
goplt/docs/content/stories/epic5/5.4-email-notification.md

2.1 KiB

Story 5.4: Email Notification System

Metadata

  • Story ID: 5.4
  • Title: Email Notification System
  • Epic: 5 - Infrastructure Adapters
  • Status: Pending
  • Priority: High
  • Estimated Time: 5-6 hours
  • Dependencies: 1.1, 2.2

Goal

Implement a complete email notification system with SMTP support, HTML email templates, and integration with identity management.

Description

This story implements email notifications using SMTP with support for HTML emails and templates. It integrates with the identity service to send verification and password reset emails.

Deliverables

1. Notification Interface (pkg/notification/notification.go)

  • Notifier interface with:
    • SendEmail(ctx context.Context, to, subject, body string) error
    • SendHTMLEmail(ctx context.Context, to, subject, htmlBody, textBody string) error
    • SendSMS(ctx context.Context, to, message string) error (placeholder)

2. SMTP Implementation (internal/infra/email/smtp_notifier.go)

  • SMTP client setup
  • HTML email support
  • Email templates for:
    • Email verification
    • Password reset
    • Welcome email

3. Integration with Identity Service

  • Send verification email on registration
  • Send password reset email
  • Send welcome email

4. Configuration

  • Email config in config/default.yaml:
    • SMTP server
    • Port
    • Username/password
    • From address

5. DI Integration

  • Provider function for Notifier
  • Register in DI container

Acceptance Criteria

  • Notification interface is defined
  • SMTP implementation works correctly
  • HTML emails are sent successfully
  • Email templates work
  • Verification emails are sent on registration
  • Password reset emails are sent
  • Configuration is loaded from config
  • Notifier is injectable via DI

Files to Create/Modify

  • pkg/notification/notification.go - Notification interface
  • internal/infra/email/smtp_notifier.go - SMTP implementation
  • internal/infra/email/templates.go - Email templates
  • internal/identity/user_service.go - Integrate email sending
  • internal/di/providers.go - Add notifier provider
  • config/default.yaml - Add email config