{
MegaBrutal's SMTP Server (MgSMTP)
- Copyright (C) 2010-2014 MegaBrutal
+ Copyright (C) 2010-2018 MegaBrutal
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
document what bugfix/feature are you testing with the actual build.
This will be logged to help you differentiate outputs of subsequent
builds in your logs. If left empty, it won't be added to the logs. }
- DEVCOMMENT = '';
+ DEVCOMMENT = 'BindAddress';
var
end;
end;
+function ConsoleCtrlHandler(Signal: dword): longbool; stdcall;
+{ Handle CTRL-C event in user mode. }
+begin
+ if Signal = CTRL_C_EVENT then begin
+ Out.writeln('Caught CTRL-C signal.');
+ Stopping:= true;
+ end;
+ Result:= true;
+end;
+
procedure Service(Argc: dword; Argv: pointer); stdcall;
var ProposedExitCode: integer;
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
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;
begin
Out.writeln('MegaBrutal''s SMTP Server, version ' + VERSION_STR + ', ' + IntToStr(PLATFORM_BITS) + ' bits');
- Out.writeln('Copyright (C) 2010-2014 MegaBrutal');
+ Out.writeln('Copyright (C) 2010-2018 MegaBrutal');
AddDevComment(Out);
Out.writeln;
else begin
if Cmdline.IsPresent('USERMODE') then begin
Out.writeln('Starting MgSMTP in user mode...');
+ SetConsoleCtrlHandler(ConsoleCtrlHandler, true);
Service(0, nil);
end
else begin
Out.writeln('Trying to contact Service Control Manager...');
Out.writeln('(If you see this message on console, you tried to');
Out.writeln('start up the program incorrectly. Your current');
- Out.writeln('attempt will fail, or it may hang under Wine.');
+ Out.writeln('attempt will fail, or it may hang under Wine.)');
Out.writeln;
ServiceMode:= true;
if not StartServiceCtrlDispatcher(ServiceTable) then begin