using System; using Volo.Abp.BackgroundJobs; using Volo.Abp.DependencyInjection; using Volo.Abp.MailKit; namespace Win_in.Sfs.Message.Application; public class EmailSendingJob : BackgroundJob, ITransientDependency { private readonly IMailKitSmtpEmailSender _emailSender; public EmailSendingJob(IMailKitSmtpEmailSender emailSender) { _emailSender = emailSender; } public override void Execute(EmailSendingArgs args) { Action action = async () => { try { await _emailSender.QueueAsync( args.EmailAddress, args.Subject, args.Body, true ).ConfigureAwait(false); } catch (Exception e) { Console.Write(e.Message); } }; action?.Invoke(); } }