Files
Orchard/src/Orchard.Web/Modules/Orchard.Email/Models/SmtpSettingsPart.cs

54 lines
1.7 KiB
C#
Raw Normal View History

using Orchard.ContentManagement;
using System;
using Orchard.ContentManagement.Utilities;
namespace Orchard.Email.Models {
2013-10-31 16:02:55 -07:00
public class SmtpSettingsPart : ContentPart {
private readonly ComputedField<string> _password = new ComputedField<string>();
public ComputedField<string> PasswordField {
get { return _password; }
}
public string Address {
2013-10-31 16:02:55 -07:00
get { return this.Retrieve(x => x.Address); }
set { this.Store(x => x.Address, value); }
}
public string Host {
2013-10-31 16:02:55 -07:00
get { return this.Retrieve(x => x.Host); }
set { this.Store(x => x.Host, value); }
}
public int Port {
2013-12-13 11:55:02 -08:00
get { return this.Retrieve(x => x.Port, 25); }
2013-10-31 16:02:55 -07:00
set { this.Store(x => x.Port, value); }
}
public bool EnableSsl {
2013-10-31 16:02:55 -07:00
get { return this.Retrieve(x => x.EnableSsl); }
set { this.Store(x => x.EnableSsl, value); }
}
public bool RequireCredentials {
2013-10-31 16:02:55 -07:00
get { return this.Retrieve(x => x.RequireCredentials); }
set { this.Store(x => x.RequireCredentials, value); }
}
public string UserName {
2013-10-31 16:02:55 -07:00
get { return this.Retrieve(x => x.UserName); }
set { this.Store(x => x.UserName, value); }
}
public string Password {
get { return _password.Value; }
set { _password.Value = value; }
}
public bool IsValid() {
2013-10-31 16:02:55 -07:00
return !String.IsNullOrWhiteSpace(Host)
&& Port > 0
&& !String.IsNullOrWhiteSpace(Address);
}
}
}