示例#1
0
        protected override void LoadList()
        {
            listDistributionLists.Items.Clear();

            hMailServer.Links             links  = APICreator.Links;
            hMailServer.Domain            domain = links.get_Domain(_domainID);
            hMailServer.DistributionLists lists  = domain.DistributionLists;

            for (int i = 0; i < lists.Count; i++)
            {
                hMailServer.DistributionList list = lists[i];

                ListViewItem item = listDistributionLists.Items.Add(list.Address);

                item.SubItems.Add(EnumStrings.GetYesNoString(list.Active));

                item.Tag = list.ID;

                Marshal.ReleaseComObject(list);
            }

            Marshal.ReleaseComObject(lists);
            Marshal.ReleaseComObject(domain);
            Marshal.ReleaseComObject(links);
        }
示例#2
0
        public void TestRenameDomainWithList()
        {
            hMailServer.DistributionList oList = _domain.DistributionLists.Add();
            oList.Address = "*****@*****.**";
            oList.Active  = true;
            oList.Save();

            hMailServer.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();

            var 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);
        }
示例#3
0
        public ucDistributionList(int domainID, int listID)
        {
            InitializeComponent();

            _domainID = domainID;

            hMailServer.Links links = APICreator.Links;

            hMailServer.Domain domain = links.get_Domain(_domainID);

            if (listID > 0)
            {
                representedObject = links.get_DistributionList(listID);
                Marshal.ReleaseComObject(links);
            }

            textAddress.Text = "@" + domain.Name;

            Marshal.ReleaseComObject(domain);

            EnableDisable();

            DirtyChecker.SubscribeToChange(this, OnContentChanged);

            new TabOrderManager(this).SetTabOrder(TabOrderManager.TabScheme.AcrossFirst);
        }
        public ucDistributionList(int domainID, int listID)
        {
            InitializeComponent();

            _domainID = domainID;

            hMailServer.Links links = APICreator.Links;

            hMailServer.Domain domain = links.get_Domain(_domainID);

            if (listID > 0)
            {
                representedObject = links.get_DistributionList(listID);
                Marshal.ReleaseComObject(links);
            }

            textAddress.Text = "@" + domain.Name;

            Marshal.ReleaseComObject(domain);

            EnableDisable();

            DirtyChecker.SubscribeToChange(this, OnContentChanged);

            new TabOrderManager(this).SetTabOrder(TabOrderManager.TabScheme.AcrossFirst);
        }
示例#5
0
 private void ConfirmDistributionListObject()
 {
     hMailServer.DistributionList list = _application.Domains[0].DistributionLists[0];
     Assert.AreEqual("*****@*****.**", list.Address);
     Assert.AreEqual(3, list.Recipients.Count);
     Assert.AreEqual("*****@*****.**", list.Recipients[0].RecipientAddress);
     Assert.AreEqual("*****@*****.**", list.Recipients[1].RecipientAddress);
     Assert.AreEqual("*****@*****.**", list.Recipients[2].RecipientAddress);
 }
示例#6
0
        public bool SaveData()
        {
            bool newObject = false;

            if (representedObject == null)
            {
                hMailServer.Domain domain = APICreator.GetDomain(_domainID);

                hMailServer.DistributionLists lists = domain.DistributionLists;
                representedObject = lists.Add();
                newObject         = true;

                Marshal.ReleaseComObject(lists);
                Marshal.ReleaseComObject(domain);
            }

            representedObject.Address = textAddress.Text;
            representedObject.Active  = checkEnabled.Checked;

            if (radioModePublic.Checked)
            {
                representedObject.Mode = eDistributionListMode.eLMPublic;
            }

            if (radioModeMembership.Checked)
            {
                representedObject.Mode = eDistributionListMode.eLMMembership;
            }

            if (optModeAnnouncements.Checked)
            {
                representedObject.Mode = eDistributionListMode.eLMAnnouncement;
            }

            representedObject.RequireSenderAddress = textRequireAddress.Text;
            representedObject.RequireSMTPAuth      = checkRequireSMTPAuthentication.Checked;

            representedObject.Save();

            // Refresh the node in the tree if the name has changed.
            IMainForm mainForm = Instances.MainForm;

            mainForm.RefreshCurrentNode(textAddress.Text);

            // Set the object to clean.
            DirtyChecker.SetClean(this);

            if (newObject)
            {
                SearchNodeText crit = new SearchNodeText(representedObject.Address);
                mainForm.SelectNode(crit);
            }

            EnableDisableTabs();

            return(true);
        }
示例#7
0
        private void SetupDistributionListObject(hMailServer.Domain domain)
        {
            List <string> listRecipients = new List <string>();

            listRecipients.Add("*****@*****.**");
            listRecipients.Add("*****@*****.**");
            listRecipients.Add("*****@*****.**");

            hMailServer.DistributionList list = SingletonProvider <Utilities> .Instance.AddDistributionList(domain, "*****@*****.**", listRecipients);
        }
示例#8
0
        public void TestDistributionListLink()
        {
            List <string> recipients = new List <string>();

            recipients.Add("Vaffe");
            recipients.Add("Baffe");
            recipients.Add("Laffe");

            hMailServer.DistributionList list =
                SingletonProvider <Utilities> .Instance.AddDistributionList(_domain, "mytest", recipients);

            Assert.AreEqual(recipients.Count, _links.get_DistributionList(list.ID).Recipients.Count);
        }
示例#9
0
        public void TestDistributionList()
        {
            hMailServer.DistributionList oList = _domain.DistributionLists.Add();
            oList.Address = "persis'*****@*****.**";
            oList.Active  = true;
            oList.Save();

            hMailServer.DistributionListRecipient oRecipient = oList.Recipients.Add();
            oRecipient.RecipientAddress = "test@te'st.com";
            oRecipient.Save();

            oRecipient.RecipientAddress = "tes'*****@*****.**";
            oRecipient.Save();
            oList.Delete();
        }
示例#10
0
        public void TestCaseInsensitivtyListRecipient()
        {
            hMailServer.Account testAccount = SingletonProvider <Utilities> .Instance.AddAccount(_domain, "*****@*****.**", "test");

            List <string> recipients = new List <string>();

            recipients.Add(testAccount.Address);

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

            hMailServer.DistributionListRecipient recipient = list.Recipients[0];
            recipient.RecipientAddress = testAccount.Address.ToUpper();

            recipient.Delete();
        }
示例#11
0
        public void OnDeleteObject(object sender, EventArgs args)
        {
            hMailServer.Links            links = APICreator.Links;
            hMailServer.DistributionList list  = links.get_DistributionList(_listID);

            if (Utility.AskDeleteItem(list.Address))
            {
                list.Delete();

                Marshal.ReleaseComObject(links);
                Marshal.ReleaseComObject(list);

                Instances.MainForm.RefreshParentNode();
            }
        }
示例#12
0
        public void TestCaseInsensitivtyList()
        {
            hMailServer.Account testAccount = SingletonProvider <Utilities> .Instance.AddAccount(_domain, "*****@*****.**", "test");

            List <string> recipients = new List <string>();

            recipients.Add(testAccount.Address);

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

            SMTPClientSimulator oSMTP = new SMTPClientSimulator();
            string upperCase          = list.Address.ToUpper();

            Assert.IsTrue(oSMTP.Send("*****@*****.**", upperCase, "test mail", "test body"));

            POP3Simulator.AssertMessageCount("*****@*****.**", "test", 1);
        }
示例#13
0
        public hMailServer.DistributionList AddDistributionList(hMailServer.Domain oDomain, string sAddress, List <string> recipients)
        {
            hMailServer.DistributionList oList = oDomain.DistributionLists.Add();
            oList.Active  = true;
            oList.Address = sAddress;
            oList.Save();

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

                Marshal.ReleaseComObject(oRecipient);
            }

            return(oList);
        }
 internal DistributionList(hMailServer.DistributionList o)
 {
     _object = o;
 }
示例#15
0
        public bool SaveData()
        {
            bool newObject = false;
            if (representedObject == null)
            {
                hMailServer.Domain domain = APICreator.GetDomain(_domainID);

                hMailServer.DistributionLists lists = domain.DistributionLists;
                representedObject = lists.Add();
                newObject = true;

                Marshal.ReleaseComObject(lists);
                Marshal.ReleaseComObject(domain);
            }

            representedObject.Address = textAddress.Text;
            representedObject.Active = checkEnabled.Checked;

            if (radioModePublic.Checked)
                representedObject.Mode = eDistributionListMode.eLMPublic;

            if (radioModeMembership.Checked)
                representedObject.Mode = eDistributionListMode.eLMMembership;

            if (optModeAnnouncements.Checked)
                representedObject.Mode = eDistributionListMode.eLMAnnouncement;

            representedObject.RequireSenderAddress = textRequireAddress.Text;
            representedObject.RequireSMTPAuth = checkRequireSMTPAuthentication.Checked;

            representedObject.Save();

            // Refresh the node in the tree if the name has changed.
            IMainForm mainForm = Instances.MainForm;
            mainForm.RefreshCurrentNode(textAddress.Text);

            // Set the object to clean.
            DirtyChecker.SetClean(this);

            if (newObject)
            {
                SearchNodeText crit = new SearchNodeText(representedObject.Address);
                mainForm.SelectNode(crit);
            }

            EnableDisableTabs();

            return true;
        }
示例#16
0
        public formImportMembers(hMailServer.DistributionList list)
        {
            InitializeComponent();

            _list = list;
        }
 internal DistributionList(hMailServer.DistributionList o)
 {
     _object = o;
 }
示例#18
0
        public formImportMembers(hMailServer.DistributionList list)
        {
            InitializeComponent();

             _list = list;
        }