Skip to content

Commit

Permalink
Testing and fixing
Browse files Browse the repository at this point in the history
  • Loading branch information
luarvic committed Apr 22, 2024
1 parent 967dbda commit 890d8d4
Showing 1 changed file with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,17 @@ public class EmailService(ILogger<EmailService> logger, IFluentEmailFactory flue

public Task SendAsync(EmailMessage emailMessage, CancellationToken cancellationToken)
{
var email = _fluentEmailFactory
BackgroundJob.Enqueue(() => CreateAndSendAsync(emailMessage, cancellationToken));
return Task.FromResult(0);
}

public async Task CreateAndSendAsync(EmailMessage emailMessage, CancellationToken cancellationToken)
{
await _fluentEmailFactory
.Create()
.To(emailMessage.ToAddress)
.Subject(emailMessage.Subject)
.Body(emailMessage.Body, isHtml: true);
BackgroundJob.Enqueue(() => email.SendAsync(cancellationToken));
return Task.FromResult(0);
.Body(emailMessage.Body, isHtml: true)
.SendAsync(cancellationToken);
}
}

0 comments on commit 890d8d4

Please sign in to comment.