コード例 #1
0
ファイル: Basics.cs プロジェクト: mr3188/hmailserver
        public void TestRenameDomainWithList()
        {
            DistributionList oList = _domain.DistributionLists.Add();

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

            DistributionListRecipient oRecipient = oList.Recipients.Add();

            oRecipient.RecipientAddress = "*****@*****.**";
            oRecipient.Save();

            oRecipient = oList.Recipients.Add();
            oRecipient.RecipientAddress = "*****@*****.**";
            oRecipient.Save();

            oRecipient = oList.Recipients.Add();
            oRecipient.RecipientAddress = "*****@*****.**";
            oRecipient.Save();

            _domain.Name = "example.com";
            _domain.Save();

            DistributionList list = _domain.DistributionLists[0];

            Assert.AreEqual("*****@*****.**", list.Address);
            Assert.AreEqual("*****@*****.**", list.Recipients[0].RecipientAddress);
            Assert.AreEqual("*****@*****.**", list.Recipients[1].RecipientAddress);
            Assert.AreEqual("*****@*****.**", list.Recipients[2].RecipientAddress);
        }
コード例 #2
0
ファイル: Basics.cs プロジェクト: yqxiao3/hmailserver
        public void TestCaseInsensitivtyListRecipient()
        {
            Account testAccount = SingletonProvider <TestSetup> .Instance.AddAccount(_domain, "*****@*****.**", "test");

            var recipients = new List <string>();

            recipients.Add(testAccount.Address);

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

            DistributionListRecipient recipient = list.Recipients[0];

            recipient.RecipientAddress = testAccount.Address.ToUpper();
            recipient.Delete();
        }
コード例 #3
0
ファイル: Basics.cs プロジェクト: mr3188/hmailserver
        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();
        }
コード例 #4
0
        public DistributionList AddDistributionList(Domain oDomain, string sAddress, List <string> recipients)
        {
            DistributionList oList = oDomain.DistributionLists.Add();

            oList.Active  = true;
            oList.Address = sAddress;
            oList.Save();

            // Add recipients
            foreach (string recipient in recipients)
            {
                DistributionListRecipient oRecipient = oList.Recipients.Add();
                oRecipient.RecipientAddress = recipient;
                oRecipient.Save();

                Marshal.ReleaseComObject(oRecipient);
            }

            return(oList);
        }
コード例 #5
0
        public DistributionList AddDistributionList(Domain domain, string sAddress, List <string> recipients)
        {
            DistributionList list = domain.DistributionLists.Add();

            list.Active  = true;
            list.Address = sAddress;
            list.Save();

            // Add recipients
            foreach (string recipientAddress in recipients)
            {
                DistributionListRecipient recipient = list.Recipients.Add();
                recipient.RecipientAddress = recipientAddress;
                recipient.Save();

                Marshal.ReleaseComObject(recipient);
            }

            return(list);
        }