2023-07-18 10:59:06 +02:00
|
|
|
using Microsoft.Extensions.Configuration;
|
|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
|
|
2026-04-07 14:23:29 +02:00
|
|
|
namespace Finch.Mails;
|
2023-07-18 10:59:06 +02:00
|
|
|
|
2026-04-07 14:23:29 +02:00
|
|
|
internal class FinchMailModule : FinchModule
|
2023-07-18 10:59:06 +02:00
|
|
|
{
|
|
|
|
|
public override void ConfigureServices(IServiceCollection services, IConfiguration configuration)
|
|
|
|
|
{
|
|
|
|
|
services.AddScoped<IMailProvider, MailProvider>();
|
2026-03-05 15:06:28 +01:00
|
|
|
//services.AddScoped<IMailDispatcher, LoggerMailDispatcher>();
|
|
|
|
|
services.AddScoped<IMailDispatcher, PostmarkDispatcher>();
|
2023-07-18 10:59:06 +02:00
|
|
|
|
2026-04-07 14:23:29 +02:00
|
|
|
services.AddOptions<MailOptions>().Bind(configuration.GetSection("Finch:Mails")).Configure(opts =>
|
2023-07-18 10:59:06 +02:00
|
|
|
{
|
|
|
|
|
opts.BuildViewPath = mail => $"~/Mails/{mail.ViewKey.Replace('.', '/')}.cshtml";
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|