From f4882400776ff6de4f796a3e8123909d5531da53 Mon Sep 17 00:00:00 2001 From: MegaBrutal Date: Mon, 15 Oct 2018 19:00:00 +0200 Subject: [PATCH] Log warning when deprecated ListenPort is used Added a nice warning message to notify users to use ListenAddress instead of ListenPort. The warning is triggered when the config has no ListenAddress declaration, but a ListenPort setting is present. Also replaced the slash with a backslash in the error message that warns about missing "Server\Name" setting. modified: MgSMTP.pas --- MgSMTP.pas | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/MgSMTP.pas b/MgSMTP.pas index 2fbc6ce..79821d9 100644 --- a/MgSMTP.pas +++ b/MgSMTP.pas @@ -179,13 +179,18 @@ begin SpoolManager:= TSpoolManager.Create(Config); PolicyManager:= TPolicyManager.Create(Config); + AddDevComment(Logger); + + if (Config.ReadString('Server', 'ListenAddress', '') = '') + and (Config.ReadString('Server', 'ListenPort', '') <> '') then + Logger.AddStdLine('WARNING! Server\ListenPort is deprecated. Use ListenAddress instead!'); + if Config.ReadBool('Spool', 'KeepProcessedEnvelopes', false) or Config.ReadBool('Spool', 'KeepProcessedEMails', false) then if not DirectoryExists('processed') then CreateDir('processed'); Config.Free; - AddDevComment(Logger); Logger.AddStdLine('Primary server name: ' + MainServerConfig.Name); Logger.AddStdLine('FCrDNS policy: ' + FCrDNSPolicyToStr(PolicyManager.FCrDNSPolicy)); if MailboxManager.DomainSpecific then @@ -231,7 +236,7 @@ begin end else begin Config.Free; - Out.writeln('Error: Server/Name is a mandatory configuration entry.'#13#10 + Out.writeln('Error: Server\Name is a mandatory configuration entry.'#13#10 + 'Please configure the application properly, refer to the manual.'); ReportSvcStatus(SERVICE_STOPPED, 2, 0); end; -- 2.34.1