public SMTPServer(string domain, int incomingPort = 25, bool supportExts = true) { listeningPort = incomingPort; allowESMTP = supportExts; config["Domain"] = domain; serverHooks = new DefaultServerHooks(); try { tcpListener = new TcpListener(IPAddress.Any, listeningPort); tcpListener.Start(); tcpListener.BeginAcceptTcpClient(HandleNewTcpConn, tcpListener); Logger.Info?.WriteLine("SMTP server now listening on: " + tcpListener.Server.LocalEndPoint.ToString()); } catch (Exception e) { Logger.Critical?.WriteLine("Critical error occured in TcpListener: " + e.ToString()); } }
public void SetServerHooks(ISMTPServerHooks hookInterface) { serverHooks = hookInterface; Logger.Debug?.WriteLine("SMTP server hooks updated."); }