Ejemplo n.º 1
0
        protected SMTPClient(ISendSettings settings, string host, int port = 25)
        {
            if (settings == null)
            {
                throw new ArgumentNullException("settings");
            }
            if (string.IsNullOrWhiteSpace(host))
            {
                throw new ArgumentNullException("host");
            }
            if (!(port >= 0))
            {
                throw new ArgumentOutOfRangeException("port");
            }

            Settings = settings;
            _stream  = new SmtpStream(host, port)
            {
                SslProtocols                  = settings.SslProtocols,
                TLSEncryptionPolicy           = settings.TLSEncryptionPolicy,
                ValidateCertificateRevocation = settings.ValidateCertificateRevocation
            };

            _stream.OnError += exception =>
            {
                LastException = exception;
            };
        }
Ejemplo n.º 2
0
        public static SMTPClient Create(CompositionContainer container, ISendSettings settings, string host,
                                        int port = 25)
        {
            if (container == null)
            {
                throw new ArgumentNullException("container");
            }
            if (settings == null)
            {
                throw new ArgumentNullException("settings");
            }
            if (string.IsNullOrWhiteSpace(host))
            {
                throw new ArgumentNullException("host");
            }
            if (!(port >= 0))
            {
                throw new ArgumentOutOfRangeException("port");
            }

            var client = new SMTPClient(settings, host, port);

            client._stream.SetupLogging(container.GetExportedValues <ISMTPLogger>());

            return(client);
        }
        public StrategyDialogService(PlayerSettingsViewModel playerSettingsViewModel, ISendSettings sendSettings)
        {
            dialogVM            = playerSettingsViewModel;
            dialogVM.OnPressOK += DialogVM_OnPressOK;

            _sendSettings = sendSettings;
        }
Ejemplo n.º 4
0
        public static ImapClient Create(ISendSettings settings, string host,
                                        int port = 143)
        {
            if (settings == null)
            {
                throw new ArgumentNullException("settings");
            }
            if (string.IsNullOrWhiteSpace(host))
            {
                throw new ArgumentNullException("host");
            }
            if (!(port >= 0))
            {
                throw new ArgumentOutOfRangeException("port");
            }

            var client = new ImapClient(settings, host, port);

            return(client);
        }
Ejemplo n.º 5
0
 public SendableMail(Mail mail, ISendSettings settings)
     : base(mail.From, mail.Recipients, mail.Headers, mail.Body)
 {
     Settings = settings;
 }
Ejemplo n.º 6
0
 public SendableMail(MailAddress from, IEnumerable <MailAddress> recipients, string mail, ISendSettings settings)
     : base(from, recipients, mail)
 {
     Settings = settings;
 }
Ejemplo n.º 7
0
 public SettingsDialogService(SettingsViewModel settingsViewModel, ISendSettings sendSettings)
 {
     dialogVM            = settingsViewModel;
     dialogVM.OnPressOK += DialogVM_OnPressOK;
     _sendSettings       = sendSettings;
 }