Exemplo n.º 1
0
        public void Logon(InternetMailProfile profile)
        {
            _profile = profile;

            client.ServerCertificateValidationCallback = (sender, certificate, chain, sslPolicyErrors) => true;
            client.Connect(profile.Pop3ServerAddress, profile.GetPop3Port());

            if (profile.User != "")
            {
                client.Authenticate(profile.User, profile.Password);
            }
        }
Exemplo n.º 2
0
        public void Logon(InternetMailProfile profile)
        {
            SecureSocketOptions options = SecureSocketOptions.Auto;

            _client.Timeout = profile.Timeout * 1000;
            _client.ServerCertificateValidationCallback = (s, c, h, e) => true;
            _client.Connect(profile.SmtpServerAddress, profile.GetSmtpPort(), options);

            if (profile.SmtpUser != "")
            {
                _client.Authenticate(profile.SmtpUser, profile.SmtpPassword);
            }
        }
Exemplo n.º 3
0
        public void Logon(InternetMailProfile profile)
        {
            _profile = profile;

            client.Timeout = _profile.Timeout * 1000;
            client.ServerCertificateValidationCallback = (sender, certificate, chain, sslPolicyErrors) => true;
            client.Connect(profile.ImapServerAddress, profile.GetImapPort());

            if (!string.IsNullOrEmpty(profile.ImapUser))
            {
                client.Authenticate(profile.ImapUser, profile.ImapPassword);
            }

            UpdateCurrentFolder();
        }
Exemplo n.º 4
0
        public void Logon(InternetMailProfile profile, InternetMailProtocol receiveMailProtocol = InternetMailProtocol.Pop3)
        {
            _profile = profile;

            if (!string.IsNullOrEmpty(_profile.SmtpServerAddress) && !_profile.Pop3BeforeSmtp)
            {
                LogonSmtp();
            }

            switch (receiveMailProtocol)
            {
            case InternetMailProtocol.Imap:

                receiver = new ImapReceiver();
                if (!string.IsNullOrEmpty(_profile.ImapServerAddress))
                {
                    receiver.Logon(_profile);
                }

                break;

            case InternetMailProtocol.Pop3:

                receiver = new Pop3Receiver();
                if (!string.IsNullOrEmpty(_profile.Pop3ServerAddress))
                {
                    receiver.Logon(_profile);
                }

                break;

            case InternetMailProtocol.Smtp:

                throw new RuntimeException("Недопустимо указывать SMTP в качестве протокола получения почты!");
            }

            if (!string.IsNullOrEmpty(_profile.SmtpServerAddress) && _profile.Pop3BeforeSmtp)
            {
                LogonSmtp();
            }
        }