2020-06-28 21:44:35 -05:00
|
|
|
using System;
|
2019-01-06 15:53:37 +01:00
|
|
|
using System.Threading.Tasks;
|
2021-11-22 17:16:08 +09:00
|
|
|
using BTCPayServer.Logging;
|
2019-01-06 15:53:37 +01:00
|
|
|
|
|
|
|
namespace BTCPayServer.Services.Mails
|
|
|
|
{
|
|
|
|
class ServerEmailSender : EmailSender
|
|
|
|
{
|
|
|
|
public ServerEmailSender(SettingsRepository settingsRepository,
|
2021-11-22 17:16:08 +09:00
|
|
|
IBackgroundJobClient backgroundJobClient,
|
|
|
|
Logs logs) : base(backgroundJobClient, logs)
|
2019-01-06 15:53:37 +01:00
|
|
|
{
|
2021-12-28 17:39:54 +09:00
|
|
|
ArgumentNullException.ThrowIfNull(settingsRepository);
|
2019-01-06 15:53:37 +01:00
|
|
|
SettingsRepository = settingsRepository;
|
|
|
|
}
|
|
|
|
|
|
|
|
public SettingsRepository SettingsRepository { get; }
|
|
|
|
|
|
|
|
public override Task<EmailSettings> GetEmailSettings()
|
|
|
|
{
|
|
|
|
return SettingsRepository.GetSettingAsync<EmailSettings>();
|
|
|
|
}
|
2024-03-19 14:58:33 +01:00
|
|
|
|
|
|
|
public override async Task<string> GetPrefixedSubject(string subject)
|
|
|
|
{
|
|
|
|
var settings = await SettingsRepository.GetSettingAsync<ServerSettings>();
|
|
|
|
var prefix = string.IsNullOrEmpty(settings?.ServerName) ? "BTCPay Server" : settings.ServerName;
|
|
|
|
return $"{prefix}: {subject}";
|
|
|
|
}
|
2019-01-06 15:53:37 +01:00
|
|
|
}
|
|
|
|
}
|