Renamed Smtp to Email

pull/6/head
Mark McDowall 12 years ago
parent d8259f5cff
commit 0d21f34ec5

@ -7,10 +7,10 @@ using NUnit.Framework;
using NzbDrone.Common.Composition; using NzbDrone.Common.Composition;
using NzbDrone.Core.Lifecycle; using NzbDrone.Core.Lifecycle;
using NzbDrone.Core.Notifications; using NzbDrone.Core.Notifications;
using NzbDrone.Core.Notifications.Email;
using NzbDrone.Core.Notifications.Growl; using NzbDrone.Core.Notifications.Growl;
using NzbDrone.Core.Notifications.Plex; using NzbDrone.Core.Notifications.Plex;
using NzbDrone.Core.Notifications.Prowl; using NzbDrone.Core.Notifications.Prowl;
using NzbDrone.Core.Notifications.Smtp;
using NzbDrone.Core.Notifications.Xbmc; using NzbDrone.Core.Notifications.Xbmc;
using NzbDrone.Core.Test.Framework; using NzbDrone.Core.Test.Framework;
@ -28,7 +28,7 @@ namespace NzbDrone.Core.Test.NotificationTests
_notifications.Add(new Xbmc(null, null)); _notifications.Add(new Xbmc(null, null));
_notifications.Add(new PlexClient(null)); _notifications.Add(new PlexClient(null));
_notifications.Add(new PlexServer(null)); _notifications.Add(new PlexServer(null));
_notifications.Add(new Smtp(null)); _notifications.Add(new Email(null));
_notifications.Add(new Growl(null)); _notifications.Add(new Growl(null));
_notifications.Add(new Prowl(null)); _notifications.Add(new Prowl(null));
@ -58,8 +58,8 @@ namespace NzbDrone.Core.Test.NotificationTests
Mocker.GetMock<IContainer>().Setup(s => s.Resolve(typeof(PlexServer))) Mocker.GetMock<IContainer>().Setup(s => s.Resolve(typeof(PlexServer)))
.Returns(new PlexServer(null)); .Returns(new PlexServer(null));
Mocker.GetMock<IContainer>().Setup(s => s.Resolve(typeof(Smtp))) Mocker.GetMock<IContainer>().Setup(s => s.Resolve(typeof(Email)))
.Returns(new Smtp(null)); .Returns(new Email(null));
Mocker.GetMock<IContainer>().Setup(s => s.Resolve(typeof(Growl))) Mocker.GetMock<IContainer>().Setup(s => s.Resolve(typeof(Growl)))
.Returns(new Growl(null)); .Returns(new Growl(null));

@ -1,15 +1,13 @@
using System; using System;
using NLog;
using NzbDrone.Core.Providers;
using NzbDrone.Core.Tv; using NzbDrone.Core.Tv;
namespace NzbDrone.Core.Notifications.Smtp namespace NzbDrone.Core.Notifications.Email
{ {
public class Smtp : NotificationBase<SmtpSettings> public class Email : NotificationBase<EmailSettings>
{ {
private readonly SmtpProvider _smtpProvider; private readonly EmailProvider _smtpProvider;
public Smtp(SmtpProvider smtpProvider) public Email(EmailProvider smtpProvider)
{ {
_smtpProvider = smtpProvider; _smtpProvider = smtpProvider;
} }

@ -3,20 +3,18 @@ using System.Net;
using System.Net.Mail; using System.Net.Mail;
using NLog; using NLog;
namespace NzbDrone.Core.Notifications.Smtp namespace NzbDrone.Core.Notifications.Email
{ {
public class SmtpProvider public class EmailProvider
{ {
private readonly Logger _logger; private readonly Logger _logger;
public SmtpProvider(Logger logger) public EmailProvider(Logger logger)
{ {
_logger = logger; _logger = logger;
} }
// var subject = "NzbDrone SMTP Test Notification"; public virtual void SendEmail(EmailSettings settings, string subject, string body, bool htmlBody = false)
// var body = "This is a test email from NzbDrone, if you received this message you properly configured your SMTP settings! (Now save them!)";
public virtual void SendEmail(SmtpSettings settings, string subject, string body, bool htmlBody = false)
{ {
var email = new MailMessage(); var email = new MailMessage();
email.From = new MailAddress(settings.From); email.From = new MailAddress(settings.From);

@ -1,32 +1,29 @@
using System; using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NzbDrone.Core.Annotations; using NzbDrone.Core.Annotations;
namespace NzbDrone.Core.Notifications.Smtp namespace NzbDrone.Core.Notifications.Email
{ {
public class SmtpSettings : INotifcationSettings public class EmailSettings : INotifcationSettings
{ {
[FieldDefinition(0, Label = "Server", HelpText = "Hostname or IP of SMTP server")] [FieldDefinition(0, Label = "Server", HelpText = "Hostname or IP of Email server")]
public String Server { get; set; } public String Server { get; set; }
[FieldDefinition(1, Label = "Port", HelpText = "SMTP Server Port")] [FieldDefinition(1, Label = "Port")]
public Int32 Port { get; set; } public Int32 Port { get; set; }
[FieldDefinition(2, Label = "Use SSL", HelpText = "Does your SMTP server use SSL?")] [FieldDefinition(2, Label = "Use SSL", HelpText = "Does your Email server use SSL?")]
public Boolean UseSsl { get; set; } public Boolean UseSsl { get; set; }
[FieldDefinition(3, Label = "Username", HelpText = "SMTP Server Username")] [FieldDefinition(3, Label = "Username")]
public String Username { get; set; } public String Username { get; set; }
[FieldDefinition(4, Label = "Password", HelpText = "SMTP Server Password")] [FieldDefinition(4, Label = "Password")]
public String Password { get; set; } public String Password { get; set; }
[FieldDefinition(5, Label = "From Address", HelpText = "Sender's address")] [FieldDefinition(5, Label = "Sender Address")]
public String From { get; set; } public String From { get; set; }
[FieldDefinition(6, Label = "To Address", HelpText = "Recipient address")] [FieldDefinition(6, Label = "Recipient Address")]
public String To { get; set; } public String To { get; set; }
public bool IsValid public bool IsValid

@ -317,7 +317,7 @@
<Compile Include="Notifications\Plex\PlexClientSettings.cs" /> <Compile Include="Notifications\Plex\PlexClientSettings.cs" />
<Compile Include="Notifications\Plex\PlexServerSettings.cs" /> <Compile Include="Notifications\Plex\PlexServerSettings.cs" />
<Compile Include="Notifications\Prowl\ProwlSettings.cs" /> <Compile Include="Notifications\Prowl\ProwlSettings.cs" />
<Compile Include="Notifications\Smtp\SmtpSettings.cs" /> <Compile Include="Notifications\Email\EmailSettings.cs" />
<Compile Include="Notifications\Xbmc\XbmcSettings.cs" /> <Compile Include="Notifications\Xbmc\XbmcSettings.cs" />
<Compile Include="Organizer\EpisodeSortingType.cs" /> <Compile Include="Organizer\EpisodeSortingType.cs" />
<Compile Include="Organizer\FileNameBuilder.cs" /> <Compile Include="Organizer\FileNameBuilder.cs" />
@ -439,7 +439,7 @@
<Compile Include="Notifications\Prowl\Prowl.cs"> <Compile Include="Notifications\Prowl\Prowl.cs">
<SubType>Code</SubType> <SubType>Code</SubType>
</Compile> </Compile>
<Compile Include="Notifications\Smtp\Smtp.cs"> <Compile Include="Notifications\Email\Email.cs">
<SubType>Code</SubType> <SubType>Code</SubType>
</Compile> </Compile>
<Compile Include="Notifications\Xbmc\Xbmc.cs"> <Compile Include="Notifications\Xbmc\Xbmc.cs">
@ -489,7 +489,7 @@
<Compile Include="Tv\SeriesService.cs"> <Compile Include="Tv\SeriesService.cs">
<SubType>Code</SubType> <SubType>Code</SubType>
</Compile> </Compile>
<Compile Include="Notifications\Smtp\SmtpProvider.cs"> <Compile Include="Notifications\Email\EmailProvider.cs">
<SubType>Code</SubType> <SubType>Code</SubType>
</Compile> </Compile>
<Compile Include="Notifications\Xbmc\XbmcProvider.cs"> <Compile Include="Notifications\Xbmc\XbmcProvider.cs">

Loading…
Cancel
Save