initial commit

This commit is contained in:
2026-07-21 14:14:44 +07:00
commit fa7dbb970d
1359 changed files with 104110 additions and 0 deletions
+46
View File
@@ -0,0 +1,46 @@
using Indotalent.Data.Entities;
using Indotalent.Infrastructure.Email.Mailgun;
using Indotalent.Infrastructure.Email.Mailjet;
using Indotalent.Infrastructure.Email.SendGrid;
using Indotalent.Infrastructure.Email.Smtp;
using Microsoft.AspNetCore.Identity;
namespace Indotalent.Infrastructure.Email;
public static class DI
{
public static IServiceCollection AddEmailService(this IServiceCollection services, IConfiguration configuration)
{
services.AddScoped<EmailService>();
var emailSettings = configuration.GetSection("EmailSettings").Get<EmailSettingsModel>() ?? new EmailSettingsModel();
if (emailSettings.SendGrid?.IsUsed == true)
{
services.AddHttpClient<IEmailSender, SendGridEmailSender>();
}
else if (emailSettings.Mailgun?.IsUsed == true)
{
services.AddHttpClient<IEmailSender, MailgunEmailSender>();
}
else if (emailSettings.Mailjet?.IsUsed == true)
{
services.AddHttpClient<IEmailSender, MailjetEmailSender>();
}
else if (emailSettings.Smtp?.IsUsed == true)
{
services.AddTransient<IEmailSender, SmtpEmailSender>();
}
else
{
services.AddScoped<IEmailSender, DefaultEmailSender>();
}
services.AddTransient<IEmailSender<ApplicationUser>, IdentityEmailManager<ApplicationUser>>();
return services;
}
}