34 lines
985 B
C#
34 lines
985 B
C#
using Volo.Abp.BackgroundJobs;
|
|
using Volo.Abp.DependencyInjection;
|
|
using Volo.Abp.MultiTenancy;
|
|
|
|
namespace Sozsoft.Sender.Mail;
|
|
|
|
public class SozsoftBackgroundEmailSendingJob :
|
|
AsyncBackgroundJob<SozsoftBackgroundEmailSendingJobArgs>, ITransientDependency
|
|
{
|
|
protected ISozsoftEmailSender EmailSender { get; }
|
|
protected ICurrentTenant CurrentTenant { get; }
|
|
|
|
public SozsoftBackgroundEmailSendingJob(
|
|
ISozsoftEmailSender emailSender,
|
|
ICurrentTenant currentTenant)
|
|
{
|
|
EmailSender = emailSender;
|
|
CurrentTenant = currentTenant;
|
|
}
|
|
|
|
public override async Task ExecuteAsync(SozsoftBackgroundEmailSendingJobArgs args)
|
|
{
|
|
using (CurrentTenant.Change(args.TenantId))
|
|
{
|
|
await EmailSender.SendEmailAsync(
|
|
args.To,
|
|
args.Sender,
|
|
args.Params,
|
|
args.TextContent,
|
|
args.Subject,
|
|
args.Attachments);
|
|
}
|
|
}
|
|
}
|