MailServerElement.cs 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Configuration;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. namespace GreenTree.Nachtragsmanagement.Core.Configuration
  8. {
  9. public class MailServerElement : ConfigurationElement
  10. {
  11. /// <summary>
  12. /// SMTP server which sends out the mails
  13. /// </summary>
  14. [ConfigurationProperty("smtpServer", DefaultValue = "localhost", IsRequired = true)]
  15. public string SmtpServer
  16. {
  17. get
  18. {
  19. return (string)this["smtpServer"];
  20. }
  21. set
  22. {
  23. this["smtpServer"] = value;
  24. }
  25. }
  26. /// <summary>
  27. /// Server port where SMTP is available
  28. /// </summary>
  29. [ConfigurationProperty("port", DefaultValue = 25, IsRequired = true)]
  30. public int Port
  31. {
  32. get
  33. {
  34. return (int)this["port"];
  35. }
  36. set
  37. {
  38. this["port"] = value;
  39. }
  40. }
  41. /// <summary>
  42. /// Username which will be authenticated against SMTP server
  43. /// </summary>
  44. [ConfigurationProperty("username", DefaultValue = "", IsRequired = false)]
  45. public string Username
  46. {
  47. get
  48. {
  49. return (string)this["username"];
  50. }
  51. set
  52. {
  53. this["username"] = value;
  54. }
  55. }
  56. /// <summary>
  57. /// Domain in which the users exists
  58. /// </summary>
  59. [ConfigurationProperty("domain", DefaultValue = "", IsRequired = false)]
  60. public string Domain
  61. {
  62. get
  63. {
  64. return (string)this["domain"];
  65. }
  66. set
  67. {
  68. this["domain"] = value;
  69. }
  70. }
  71. /// <summary>
  72. /// Password of the authenticated user
  73. /// </summary>
  74. [ConfigurationProperty("password", DefaultValue = "", IsRequired = false)]
  75. public string Password
  76. {
  77. get
  78. {
  79. return (string)this["password"];
  80. }
  81. set
  82. {
  83. this["password"] = value;
  84. }
  85. }
  86. /// <summary>
  87. /// Determines if the connection should use SSL/TLS
  88. /// </summary>
  89. [ConfigurationProperty("useSsl", DefaultValue = false, IsRequired = false)]
  90. public bool UseSsl
  91. {
  92. get
  93. {
  94. return (bool)this["useSsl"];
  95. }
  96. set
  97. {
  98. this["useSsl"] = value;
  99. }
  100. }
  101. }
  102. }