Exemplo n.º 1
0
        private void StartServer(SmtpServerConnectorConfig config)
        {
            if (_listener != null)
            {
                return;
            }

            this.Log.Info($"The SMTP server is not running, starting {config.ServerName} on {string.Join(",", config.Ports)}");
            _listener = new SmtpServerListener(config.ServerName, config.Ports);
            _listener.MessageReceived += (sender, message) => { this.RaiseMessageReceived(message); };
            var task = _listener.Start();

            task.ConfigureAwait(false);
        }
Exemplo n.º 2
0
        private static async Task Main(string[] args)
        {
            var log4netConfig = new XmlDocument();

            log4netConfig.Load(File.OpenRead("log4net.config"));
            var repo = LogManager.CreateRepository(Assembly.GetEntryAssembly(), typeof(Hierarchy));

            XmlConfigurator.Configure(repo, log4netConfig["log4net"]);

            Log.Info("START CONSOLE");

            var server = new SmtpServerListener("localhost", 25, 587);
            await server.Start();

            Console.ReadKey();

            Log.Info("STOP CONSOLE");
        }