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:
@@ -0,0 +1,17 @@
|
||||
using ColaFlow.Modules.Identity.Domain.Services;
|
||||
|
||||
namespace ColaFlow.Modules.Identity.Application.Services;
|
||||
|
||||
/// <summary>
|
||||
/// Service for sending emails
|
||||
/// </summary>
|
||||
public interface IEmailService
|
||||
{
|
||||
/// <summary>
|
||||
/// Sends an email message
|
||||
/// </summary>
|
||||
/// <param name="message">The email message to send</param>
|
||||
/// <param name="cancellationToken">Cancellation token</param>
|
||||
/// <returns>True if email was sent successfully, false otherwise</returns>
|
||||
Task<bool> SendEmailAsync(EmailMessage message, CancellationToken cancellationToken = default);
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
namespace ColaFlow.Modules.Identity.Application.Services;
|
||||
|
||||
/// <summary>
|
||||
/// Service for rendering email templates
|
||||
/// </summary>
|
||||
public interface IEmailTemplateService
|
||||
{
|
||||
/// <summary>
|
||||
/// Renders a verification email template
|
||||
/// </summary>
|
||||
/// <param name="recipientName">Name of the recipient</param>
|
||||
/// <param name="verificationUrl">URL for email verification</param>
|
||||
/// <returns>HTML email body</returns>
|
||||
string RenderVerificationEmail(string recipientName, string verificationUrl);
|
||||
|
||||
/// <summary>
|
||||
/// Renders a password reset email template
|
||||
/// </summary>
|
||||
/// <param name="recipientName">Name of the recipient</param>
|
||||
/// <param name="resetUrl">URL for password reset</param>
|
||||
/// <returns>HTML email body</returns>
|
||||
string RenderPasswordResetEmail(string recipientName, string resetUrl);
|
||||
|
||||
/// <summary>
|
||||
/// Renders a tenant invitation email template
|
||||
/// </summary>
|
||||
/// <param name="recipientName">Name of the recipient</param>
|
||||
/// <param name="tenantName">Name of the tenant</param>
|
||||
/// <param name="inviterName">Name of the person who sent the invitation</param>
|
||||
/// <param name="invitationUrl">URL for accepting the invitation</param>
|
||||
/// <returns>HTML email body</returns>
|
||||
string RenderInvitationEmail(
|
||||
string recipientName,
|
||||
string tenantName,
|
||||
string inviterName,
|
||||
string invitationUrl);
|
||||
}
|
||||
Reference in New Issue
Block a user