From 92391e7c037735a9ac161905fb400a1bb3e70825 Mon Sep 17 00:00:00 2001 From: Niko Ehrenfeuchter <nikolaus.ehrenfeuchter@unibas.ch> Date: Mon, 18 Dec 2017 23:57:52 +0100 Subject: [PATCH] Make SMTP configuration elements optional. --- AutoTx/Resources/configuration-example.xml | 15 +++++++++------ AutoTx/XmlWrapper/ServiceConfig.cs | 17 +++++++++++++---- 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/AutoTx/Resources/configuration-example.xml b/AutoTx/Resources/configuration-example.xml index 3b43030..9894ee6 100644 --- a/AutoTx/Resources/configuration-example.xml +++ b/AutoTx/Resources/configuration-example.xml @@ -62,12 +62,6 @@ <ProcessName>wordpad</ProcessName> </BlacklistedProcesses> - <SmtpHost>smtp.mydomain.xy</SmtpHost> - <!--><SmtpHost /><--> - <SmtpPort>25</SmtpPort> - <SmtpUserCredential /> - <SmtpPasswortCredential /> - <!-- SendAdminNotification: send email to user on finished transfers --> <SendTransferNotification>true</SendTransferNotification> <EmailFrom>admin@mydomain.xy</EmailFrom> @@ -85,6 +79,15 @@ <!-- OPTIONAL CONFIGURATION SETTINGS --> + <!-- SmtpHost: SMTP server hostname --> + <SmtpHost>smtp.mydomain.xy</SmtpHost> + <!-- SmtpPort: SMTP server port, defaults to 25 if omitted --> + <SmtpPort>25</SmtpPort> + <!-- SmtpUserCredential: SMTP user name if authentication required --> + <SmtpUserCredential /> + <!-- SmtpPasswortCredential: SMTP password if authentication required --> + <SmtpPasswortCredential /> + <!-- EnforceInheritedACLs: whether to enforce ACL inheritance when moving files and directories, see this page for details (DEFAULT: true) https://support.microsoft.com/en-us/help/320246 --> diff --git a/AutoTx/XmlWrapper/ServiceConfig.cs b/AutoTx/XmlWrapper/ServiceConfig.cs index 129b874..bcfc890 100644 --- a/AutoTx/XmlWrapper/ServiceConfig.cs +++ b/AutoTx/XmlWrapper/ServiceConfig.cs @@ -14,8 +14,14 @@ namespace AutoTx.XmlWrapper { public ServiceConfig() { // set values for the optional XML elements: + SmtpHost = ""; + SmtpPort = 25; + SmtpUserCredential = ""; + SmtpPasswortCredential = ""; EnforceInheritedACLs = true; } + + #region required configuration parameters /// <summary> /// A human friendly name for the host, to be used in emails etc. @@ -59,9 +65,7 @@ namespace AutoTx.XmlWrapper /// to keep the temporary data of running transfers. /// </summary> public string TmpTransferDir { get; set; } - public string SmtpHost { get; set; } - public string SmtpUserCredential { get; set; } - public string SmtpPasswortCredential { get; set; } + public string EmailFrom { get; set; } public string AdminEmailAdress { get; set; } public string AdminDebugEmailAdress { get; set; } @@ -71,7 +75,6 @@ namespace AutoTx.XmlWrapper public int InterPacketGap { get; set; } public int MaxCpuUsage { get; set; } public int MinAvailableMemory { get; set; } - public int SmtpPort { get; set; } public int AdminNotificationDelta { get; set; } public int StorageNotificationDelta { get; set; } @@ -93,10 +96,16 @@ namespace AutoTx.XmlWrapper [XmlArrayItem(ElementName = "ProcessName")] public List<string> BlacklistedProcesses { get; set; } + #endregion #region optional configuration parameters + public string SmtpHost { get; set; } + public string SmtpUserCredential { get; set; } + public string SmtpPasswortCredential { get; set; } + public int SmtpPort { get; set; } + /// <summary> /// EnforceInheritedACLs: whether to enforce ACL inheritance when moving files and /// directories, see https://support.microsoft.com/en-us/help/320246 for more details. -- GitLab