Refactor SendEmailAsync to use EmailContext object

Simplified the `SendEmailAsync` method in the `IEmailService`
interface to accept a single `EmailContext` object instead of
multiple parameters. Updated the `SendingEmailConsumer` and
`LimilabsEmailService` classes to align with this change.

In `LimilabsEmailService`, refactored email construction logic
to use properties from the `EmailContext` object, including
`Sender`, `Recipients`, `Subject`, `Body`, and `IsHtml`.
Updated `ConnectAndAuthenticateSmtpAsync` to use the `Sender`
property from `EmailContext`.

These changes improve code readability, reduce parameter
complexity, and ensure consistency across the email service
implementation.
This commit is contained in:
2026-08-05 14:14:27 +02:00
parent 3cd8841e80
commit 42b30d4ac4
3 changed files with 10 additions and 19 deletions

View File

@@ -14,5 +14,5 @@ public interface IEmailService
/// Sends an email using the configured SMTP account.
/// SMTP credentials are configured in appsettings.json (EmailAccount section).
/// </summary>
Task SendEmailAsync(EmailAccountDto from, IEnumerable<string> recipients, string subject, string body, bool isHtml = true, CancellationToken cancellationToken = default);
Task SendEmailAsync(EmailContext context, CancellationToken cancellationToken = default);
}