/// <summary> /// Constructor. /// </summary> /// <param name="options">The SMTP server options.</param> /// <param name="serviceProvider">The service provider to use when resolving services.</param> public SmtpServer(ISmtpServerOptions options, IServiceProvider serviceProvider) { _options = options; _serviceProvider = serviceProvider; _sessions = new SmtpSessionManager(this); _endpointListenerFactory = serviceProvider.GetServiceOrDefault(EndpointListenerFactory.Default); }
/// <summary> /// Adds an Endpoint Listener Factory instance. /// </summary> /// <param name="value">The TCP listener factory instance to use.</param> /// <returns>A OptionsBuilder to continue building on.</returns> public SmtpServerOptionsBuilder EndpointListenerFactory(IEndpointListenerFactory value) { _setters.Add(options => options.EndpointListenerFactory = value ?? new EndpointListenerFactory()); return(this); }
/// <summary> /// Add an instance of the endpoint listener factory. /// </summary> /// <param name="endpointListenerFactory">The endpoint listener factory.</param> public void Add(IEndpointListenerFactory endpointListenerFactory) { _endpointListenerFactory = endpointListenerFactory; }