2010-12-03 16:14:17 -08:00
|
|
|
|
using Orchard.ContentManagement;
|
2010-08-30 15:06:52 -07:00
|
|
|
|
using System;
|
2010-12-03 16:14:17 -08:00
|
|
|
|
using Orchard.ContentManagement.Utilities;
|
2010-08-30 15:06:52 -07:00
|
|
|
|
|
|
|
|
|
namespace Orchard.Email.Models {
|
2013-10-31 16:02:55 -07:00
|
|
|
|
public class SmtpSettingsPart : ContentPart {
|
2010-12-03 16:14:17 -08:00
|
|
|
|
private readonly ComputedField<string> _password = new ComputedField<string>();
|
|
|
|
|
|
|
|
|
|
public ComputedField<string> PasswordField {
|
|
|
|
|
get { return _password; }
|
2010-08-30 15:06:52 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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); }
|
2010-08-30 15:06:52 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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); }
|
2010-08-30 15:06:52 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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); }
|
2010-08-30 15:06:52 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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); }
|
2010-08-30 15:06:52 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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); }
|
2010-08-30 15:06:52 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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); }
|
2010-08-30 15:06:52 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public string Password {
|
2014-02-28 23:23:56 +01:00
|
|
|
|
get { return _password.Value; }
|
|
|
|
|
set { _password.Value = value; }
|
2010-12-03 16:14:17 -08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public bool IsValid() {
|
2013-10-31 16:02:55 -07:00
|
|
|
|
return !String.IsNullOrWhiteSpace(Host)
|
|
|
|
|
&& Port > 0
|
|
|
|
|
&& !String.IsNullOrWhiteSpace(Address);
|
2010-08-30 15:06:52 -07:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|