type
TMgSMTPListener = class(TTCPListener)
- constructor Create(const Address: string; Port: word);
+ constructor Create(const Address: string; Port, Family: word);
protected
procedure HandleClient(Connection: TTCPConnection); override;
procedure ReceiveEMailData(TCP: TTCPRFCConnection; Response: TRFCReply; SpoolObject: TSpoolObjectCreator);
procedure StartListeners;
-var i: integer; address, port: string;
+var i, j: integer; address, port: string; nport: word;
begin
- SetLength(MgSMTPListeners, MainServerConfig.ListenAddresses.Count);
- for i:= 0 to Length(MgSMTPListeners) - 1 do begin
+ SetLength(MgSMTPListeners, MainServerConfig.ListenAddresses.Count + MainServerConfig.ListenAddresses6.Count);
+ for i:= 0 to MainServerConfig.ListenAddresses.Count - 1 do begin
SplitParameters(MainServerConfig.ListenAddresses.Strings[i], address, port, ':');
- MgSMTPListeners[i]:= TMgSMTPListener.Create(address, StrToIntDef(port, STANDARD_SMTP_PORT));
+ MgSMTPListeners[i]:= TMgSMTPListener.Create(address, StrToIntDef(port, STANDARD_SMTP_PORT), AF_INET);
MgSMTPListeners[i].StartListen;
end;
+ j:= MainServerConfig.ListenAddresses.Count;
+ for i:= 0 to MainServerConfig.ListenAddresses6.Count - 1 do begin
+ ParseIPv6Address(MainServerConfig.ListenAddresses6.Strings[i], address, nport);
+ MgSMTPListeners[j+i]:= TMgSMTPListener.Create(address, nport, AF_INET6);
+ MgSMTPListeners[j+i].StartListen;
+ end;
end;
procedure StopListeners;
end;
-constructor TMgSMTPListener.Create(const Address: string; Port: word);
+constructor TMgSMTPListener.Create(const Address: string; Port, Family: word);
begin
{ Request connection objects with support for RFC-style commands & responses. }
- inherited Create(Address, Port, NET_TCP_RFCSUPPORT);
+ inherited Create(Address, Port, Family, NET_TCP_RFCSUPPORT);
Logger.AddLine('Server', 'Listening on address: ' + Address + ':' + IntToStr(Port));
end;