/// <summary>
        /// Initializes the instance of SMTP server with TLS certificate.
        /// </summary>
        /// <param name="parameters">Listening parameters</param>
        /// <param name="options">Server options</param>
        /// <param name="deliveryInterface">Interface used for email delivery.</param>
        /// <param name="loggerInterface">Interface used for logging server errors.</param>
        /// <param name="certificate">TLS certificate of the server.</param>
        public SMTPServer(IEnumerable <ListeningParameters> parameters, ServerOptions options, IMailDelivery deliveryInterface, ILogger loggerInterface,
                          X509Certificate certificate)
        {
            if (SMTPCodes.Codes == null)
            {
                SMTPCodes.Init();
            }

            Options = options;
            MailDeliveryInterface = deliveryInterface;
            LoggerInterface       = loggerInterface;
            Certificate           = certificate;

            Listeners = new List <Listener>();

            foreach (var parameter in parameters)
            {
                foreach (var port in parameter.RegularPorts)
                {
                    Listeners.Add(new Listener(parameter.IpAddress, port, this, false));
                }

                foreach (var port in parameter.TlsPorts)
                {
                    Listeners.Add(new Listener(parameter.IpAddress, port, this, true));
                }
            }
        }
 /// <summary>
 /// Initializes the instance of SMTP server without TLS certificate.
 /// </summary>
 /// <param name="parameters">Listening parameters</param>
 /// <param name="options">Server options</param>
 /// <param name="deliveryInterface">Interface used for email delivery.</param>
 /// <param name="loggerInterface">Interface used for logging server errors.</param>
 public SMTPServer(IEnumerable <ListeningParameters> parameters, ServerOptions options, IMailDelivery deliveryInterface, ILogger loggerInterface) :
     this(parameters, options, deliveryInterface, loggerInterface, null)
 {
 }
Exemple #3
0
 public MailClient(IMailDelivery delivery, IMailStorage storage, IMailLogger logger)
 {
     this.delivery = delivery;
     this.storage  = storage;
     this.logger   = logger;
 }