コード例 #1
0
        void TestEmailAccount()
        {
            var testEmailAccount = GetTestEmailAccount();

            if (string.IsNullOrEmpty(testEmailAccount))
            {
                return;
            }
            CanTestEmailAccount = false;

            var testSource = new EmailSource(SelectedEmailSource.ToXml());

            if (!string.IsNullOrEmpty(FromAccount))
            {
                testSource.UserName = FromAccount;
                testSource.Password = Password;
            }
            testSource.TestFromAddress = testSource.UserName;
            testSource.TestToAddress   = testEmailAccount;

            Uri uri      = new Uri(new Uri(AppSettings.LocalHost), "wwwroot/sources/Service/EmailSources/Test");
            var jsonData = testSource.ToString();

            var requestInvoker = CreateWebRequestInvoker();

            requestInvoker.ExecuteRequest("POST", uri.ToString(), jsonData, null, OnTestCompleted);
        }
コード例 #2
0
        void TestEmailAccount()
        {
            var testEmailAccount = GetTestEmailAccount();

            if (string.IsNullOrEmpty(testEmailAccount))
            {
                Errors = new List <IActionableErrorInfo> {
                    new ActionableErrorInfo(() => IsToFocused = true)
                    {
                        Message = "Please supply a To address in order to Test."
                    }
                };
                return;
            }
            CanTestEmailAccount = false;

            var testSource = new EmailSource(SelectedEmailSource.ToXml());

            if (!string.IsNullOrEmpty(FromAccount))
            {
                testSource.UserName = FromAccount;
                testSource.Password = Password;
            }
            testSource.TestFromAddress = testSource.UserName;
            testSource.TestToAddress   = testEmailAccount;
            if (EmailAddresssIsAVariable(testEmailAccount))
            {
                return;
            }
            Uri uri      = new Uri(new Uri(AppSettings.LocalHost), "wwwroot/sources/Service/EmailSources/Test");
            var jsonData = testSource.ToString();

            var requestInvoker = CreateWebRequestInvoker();

            requestInvoker.ExecuteRequest("POST", uri.ToString(), jsonData, null, OnTestCompleted);
        }