コード例 #1
0
        /// <inheritdoc cref="IMailboxValidator.ValidateSynchronization"/>
        public CredentialsValidationInfo ValidateSynchronization(Mailbox mailbox)
        {
            var answer = new CredentialsValidationInfo {
                IsValid = true
            };

            try {
                var credentials = new MailCredentials {
                    UserName           = mailbox.Login,
                    UserPassword       = mailbox.Password,
                    SenderEmailAddress = mailbox.SenderEmailAddress,
                    Host     = mailbox.GetServerAddress(),
                    Port     = mailbox.GetServerPort(),
                    UseSsl   = mailbox.UseSsl,
                    StartTls = mailbox.StartTls
                };
                var imapClient = ClassFactory.Get <IImapClient>("OldEmailIntegration",
                                                                new ConstructorArgument("credentials", credentials),
                                                                new ConstructorArgument("errorMessages", new Terrasoft.Mail.ImapErrorMessages()),
                                                                new ConstructorArgument("userConnection", UserConnection),
                                                                new ConstructorArgument("login", true));
            }
            catch (ImapException exception) {
                answer.IsValid = false;
                answer.Message = ConnectToServerCaption + exception.Message;
            }
            return(answer);
        }
コード例 #2
0
        /// <inheritdoc cref="IMailboxValidator.ValidateSynchronization"/>
        public CredentialsValidationInfo ValidateSynchronization(Mailbox mailbox)
        {
            var answer = new CredentialsValidationInfo {
                IsValid = true
            };

            try {
                var imapClient = new ImapClient(new MailCredentials {
                    UserName           = mailbox.Login,
                    UserPassword       = mailbox.Password,
                    SenderEmailAddress = mailbox.SenderEmailAddress,
                    Host   = mailbox.GetServerAddress(),
                    Port   = mailbox.GetServerPort(),
                    UseSsl = mailbox.UseSsl
                }, MailSynchronizer.GetImapErrorMessages(UserConnection), UserConnection, true);
            }
            catch (ImapException exception) {
                answer.IsValid = false;
                answer.Message = ConnectToServerCaption + exception.Message;
            }
            return(answer);
        }