Beispiel #1
0
 public static void MyClassCleanup()
 {
     if (_tempList != null)
     {
         WebCallResult res = _tempList.Delete();
         Assert.IsTrue(res.Success, "Failed to delete temporary distribution list on cleanup.");
     }
 }
        public void TestDistributionListsMembershipDomainAliases()
        {
            var oIMAP = new IMAPClientSimulator();
            var oSMTP = new SMTPClientSimulator();

            Application application = SingletonProvider <TestSetup> .Instance.GetApp();


            DomainAlias oDA = _domain.DomainAliases.Add();

            oDA.AliasName = "dummy-example.com";
            oDA.Save();

            Account oAccount = SingletonProvider <TestSetup> .Instance.AddAccount(_domain, "*****@*****.**", "test");

            oAccount = SingletonProvider <TestSetup> .Instance.AddAccount(_domain, "*****@*****.**", "test");


            //
            // TEST LIST SECURITY IN COMBINATION WITH DOMAIN NAME ALIASES
            //


            var oRecipients = new List <string>();

            oRecipients.Clear();
            oRecipients.Add("*****@*****.**");

            DistributionList oList3 = SingletonProvider <TestSetup> .Instance.AddDistributionList(_domain, "*****@*****.**",
                                                                                                  oRecipients);

            oList3.Mode = eDistributionListMode.eLMMembership;
            oList3.Save();

            // THIS MESSAGE SHOULD FAIL - Membership required, unknown sender domain
            CustomAssert.IsFalse(oSMTP.Send("*****@*****.**", "*****@*****.**", "Mail 1", "Mail 1"));

            oList3.Delete();

            // THIS MESSAGE SHOULD SUCCED - Membership required, sender domain is now an alias for test.com.

            oRecipients = new List <string>();
            oRecipients.Clear();
            oRecipients.Add("*****@*****.**");
            oRecipients.Add("*****@*****.**");

            oList3 = SingletonProvider <TestSetup> .Instance.AddDistributionList(_domain, "*****@*****.**", oRecipients);

            oList3.Mode = eDistributionListMode.eLMMembership;
            oList3.Save();

            CustomAssert.IsTrue(oSMTP.Send("*****@*****.**", "*****@*****.**", "Mail 1", "Mail 1"));

            IMAPClientSimulator.AssertMessageCount("*****@*****.**", "test", "Inbox", 1);
            IMAPClientSimulator.AssertMessageCount("*****@*****.**", "test", "Inbox", 1);
        }
        public void TestDistributionListsMembershipDomainAliases()
        {
            var imap = new ImapClientSimulator();
            var smtpClientSimulator = new SmtpClientSimulator();

            Application application = SingletonProvider <TestSetup> .Instance.GetApp();


            DomainAlias domainAlias = _domain.DomainAliases.Add();

            domainAlias.AliasName = "dummy-example.com";
            domainAlias.Save();

            Account account = SingletonProvider <TestSetup> .Instance.AddAccount(_domain, "*****@*****.**", "test");

            account = SingletonProvider <TestSetup> .Instance.AddAccount(_domain, "*****@*****.**", "test");


            //
            // TEST LIST SECURITY IN COMBINATION WITH DOMAIN NAME ALIASES
            //


            var recipients = new List <string>();

            recipients.Clear();
            recipients.Add("*****@*****.**");

            DistributionList list3 = SingletonProvider <TestSetup> .Instance.AddDistributionList(_domain, "*****@*****.**",
                                                                                                 recipients);

            list3.Mode = eDistributionListMode.eLMMembership;
            list3.Save();

            // THIS MESSAGE SHOULD FAIL - Membership required, unknown sender domain
            CustomAsserts.Throws <DeliveryFailedException>(() => smtpClientSimulator.Send("*****@*****.**", "*****@*****.**", "Mail 1", "Mail 1"));

            list3.Delete();

            // THIS MESSAGE SHOULD SUCCED - Membership required, sender domain is now an alias for test.com.

            recipients = new List <string>();
            recipients.Clear();
            recipients.Add("*****@*****.**");
            recipients.Add("*****@*****.**");

            list3 = SingletonProvider <TestSetup> .Instance.AddDistributionList(_domain, "*****@*****.**", recipients);

            list3.Mode = eDistributionListMode.eLMMembership;
            list3.Save();

            smtpClientSimulator.Send("*****@*****.**", "*****@*****.**", "Mail 1", "Mail 1");

            ImapClientSimulator.AssertMessageCount("*****@*****.**", "test", "Inbox", 1);
            ImapClientSimulator.AssertMessageCount("*****@*****.**", "test", "Inbox", 1);
        }
Beispiel #4
0
        public void TestDistributionList()
        {
            DistributionList oList = _domain.DistributionLists.Add();

            oList.Address = "persis'*****@*****.**";
            oList.Active  = true;
            oList.Save();

            DistributionListRecipient oRecipient = oList.Recipients.Add();

            oRecipient.RecipientAddress = "test@te'st.com";
            oRecipient.Save();

            oRecipient.RecipientAddress = "tes'*****@*****.**";
            oRecipient.Save();
            oList.Delete();
        }