You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
53 lines
1.4 KiB
53 lines
1.4 KiB
using System.Collections.Generic;
|
|
using FluentValidation.Results;
|
|
using NzbDrone.Common.Extensions;
|
|
using NzbDrone.Core.Tv;
|
|
|
|
namespace NzbDrone.Core.Notifications.Email
|
|
{
|
|
public class Email : NotificationBase<EmailSettings>
|
|
{
|
|
private readonly IEmailService _emailService;
|
|
|
|
public Email(IEmailService emailService)
|
|
{
|
|
_emailService = emailService;
|
|
}
|
|
|
|
public override string Link => null;
|
|
|
|
public override void OnGrab(GrabMessage grabMessage)
|
|
{
|
|
const string subject = "Radarr [TV] - Grabbed";
|
|
var body = string.Format("{0} sent to queue.", grabMessage.Message);
|
|
|
|
_emailService.SendEmail(Settings, subject, body);
|
|
}
|
|
|
|
public override void OnDownload(DownloadMessage message)
|
|
{
|
|
const string subject = "Radarr [TV] - Downloaded";
|
|
var body = string.Format("{0} Downloaded and sorted.", message.Message);
|
|
|
|
_emailService.SendEmail(Settings, subject, body);
|
|
}
|
|
|
|
public override void OnRename(Series series)
|
|
{
|
|
}
|
|
|
|
public override string Name => "Email";
|
|
|
|
public override bool SupportsOnRename => false;
|
|
|
|
public override ValidationResult Test()
|
|
{
|
|
var failures = new List<ValidationFailure>();
|
|
|
|
failures.AddIfNotNull(_emailService.Test(Settings));
|
|
|
|
return new ValidationResult(failures);
|
|
}
|
|
}
|
|
}
|