internal void RefreshServers()
        {
            StopSMTPServers();

            _servers = _receiveConnectors.All().Select(r =>
            {
                var server = new SMTPService(r, _smtpServer, _container);
                _container.SatisfyImportsOnce(server);
                return(server);
            })
                       .ToArray();

            StartSMTPServers();
        }
Example #2
0
        public ClientHandler(TcpClient client, SMTPService smtpServer, CompositionContainer container)
        {
            _client     = client;
            _smtpServer = smtpServer;

            var certProvider = _smtpServer.Connector.TLSSettings.CertificateType != null
                ? container.GetExportedValue <ICertificateProvider>(_smtpServer.Connector.TLSSettings.CertificateType)
                : null;

            _tlsConnector   = new TLSConnector(_smtpServer.Connector.TLSSettings, CertificateLog, certProvider);
            _localEndpoint  = (IPEndPoint)_client.Client.LocalEndPoint;
            _remoteEndpoint = (IPEndPoint)_client.Client.RemoteEndPoint;
            _name           = _localEndpoint.Address.ToString();
            _stream         = _client.GetStream();
            _startTLS       = false;
        }