API
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

SMTPHost.cs 1.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. using System.Collections.Generic;
  2. using System.Net;
  3. namespace UnivateProperties_API.Model.Communication
  4. {
  5. public class SMTPHost : BaseEntity
  6. {
  7. #region Constructor
  8. public SMTPHost()
  9. {
  10. }
  11. public SMTPHost(string host, bool needsAutorize, string user, string password)
  12. {
  13. Host = host;
  14. User = user;
  15. NeedsAuthorize = needsAutorize;
  16. Password = password;
  17. }
  18. #endregion
  19. #region Properties
  20. public string Host { get; set; }
  21. public bool NeedsAuthorize { get; set; } = false;
  22. public string User { get; set; }
  23. public string Password { get; set; }
  24. public bool UseSSL { get; set; } = false;
  25. public virtual ICollection<SMTPAccount> SMTPAccounts { get; set; }
  26. #endregion Properties
  27. #region Methods
  28. public NetworkCredential GetNetworkCredential()
  29. {
  30. if (NeedsAuthorize)
  31. {
  32. return new NetworkCredential(User, Password);
  33. }
  34. return null;
  35. }
  36. #endregion
  37. }
  38. }