Beispiel #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;
            };
        }
Beispiel #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;
        }
Beispiel #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);
        }
Beispiel #5
0
 public SendableMail(Mail mail, ISendSettings settings)
     : base(mail.From, mail.Recipients, mail.Headers, mail.Body)
 {
     Settings = settings;
 }
Beispiel #6
0
 public SendableMail(MailAddress from, IEnumerable <MailAddress> recipients, string mail, ISendSettings settings)
     : base(from, recipients, mail)
 {
     Settings = settings;
 }
Beispiel #7
0
 public SettingsDialogService(SettingsViewModel settingsViewModel, ISendSettings sendSettings)
 {
     dialogVM            = settingsViewModel;
     dialogVM.OnPressOK += DialogVM_OnPressOK;
     _sendSettings       = sendSettings;
 }