23 lines
678 B
C#
23 lines
678 B
C#
using Socialize.Infrastructure.Emailer.Contracts;
|
|
|
|
namespace Socialize.Infrastructure.Emailer.Services;
|
|
|
|
public class LoggerEmailSender(ILogger<IEmailSender> logger)
|
|
: IEmailSender
|
|
{
|
|
public async Task SendEmailAsync(string email, string subject, string message)
|
|
{
|
|
try
|
|
{
|
|
logger.LogInformation("Sending email to {Email} with subject: {Subject}", email, subject);
|
|
await Task.Delay(1000);
|
|
logger.LogInformation("Email sent successfully to {Email}", email);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
logger.LogError(ex, "Failed to send email to {Email}", email);
|
|
throw;
|
|
}
|
|
}
|
|
}
|