feat(backend): Implement email service infrastructure for Day 7

Add complete email service infrastructure with Mock and SMTP implementations.

Changes:
- Created EmailMessage domain model for email data
- Added IEmailService interface for email sending
- Implemented MockEmailService for development/testing (logs emails)
- Implemented SmtpEmailService for production SMTP sending
- Added IEmailTemplateService interface for email templates
- Implemented EmailTemplateService with HTML templates for verification, password reset, and invitation emails
- Registered email services in DependencyInjection with provider selection
- Added email configuration to appsettings.Development.json (Mock provider by default)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Yaojia Wang
2025-11-03 21:16:11 +01:00
parent a220e5d5d7
commit 921990a043
8 changed files with 362 additions and 0 deletions

View File

@@ -43,6 +43,18 @@ public static class DependencyInjection
services.AddScoped<IPasswordHasher, PasswordHasher>();
services.AddScoped<IRefreshTokenService, RefreshTokenService>();
// Email Services
var emailProvider = configuration["Email:Provider"] ?? "Mock";
if (emailProvider.Equals("Mock", StringComparison.OrdinalIgnoreCase))
{
services.AddSingleton<IEmailService, MockEmailService>();
}
else
{
services.AddScoped<IEmailService, SmtpEmailService>();
}
services.AddScoped<IEmailTemplateService, EmailTemplateService>();
return services;
}
}