mirror of https://github.com/abpframework/abp
Resolved #546: Initial implementation of "Create a service to send emails in background jobs"
parent
22184fbc40
commit
4875d2e716
@ -0,0 +1,19 @@
|
||||
using Volo.Abp.BackgroundJobs;
|
||||
|
||||
namespace Volo.Abp.Emailing
|
||||
{
|
||||
public class BackgroundEmailSendingJob : BackgroundJob<BackgroundEmailSendingJobArgs>
|
||||
{
|
||||
protected IEmailSender EmailSender { get; }
|
||||
|
||||
public BackgroundEmailSendingJob(IEmailSender emailSender)
|
||||
{
|
||||
EmailSender = emailSender;
|
||||
}
|
||||
|
||||
public override void Execute(BackgroundEmailSendingJobArgs args)
|
||||
{
|
||||
EmailSender.Send(args.To, args.Subject, args.Body, args.IsBodyHtml);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
using System;
|
||||
|
||||
namespace Volo.Abp.Emailing
|
||||
{
|
||||
[Serializable]
|
||||
public class BackgroundEmailSendingJobArgs
|
||||
{
|
||||
public string To { get; set; }
|
||||
|
||||
public string Subject { get; set; }
|
||||
|
||||
public string Body { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Default: true.
|
||||
/// </summary>
|
||||
public bool IsBodyHtml { get; set; } = true;
|
||||
|
||||
//TODO: Add other properties and attachments
|
||||
}
|
||||
}
|
Loading…
Reference in new issue