Пример #1
0
        private void EditSelectedItem()
        {
            if (listRecipients.SelectedItems.Count != 1)
            {
                return;
            }

            formInputDialog inputDialog = new formInputDialog();

            int id = Convert.ToInt32(listRecipients.SelectedItems[0].Tag);

            hMailServer.DistributionListRecipients recipients = representedObject.Recipients;
            hMailServer.DistributionListRecipient  recipient  = recipients.get_ItemByDBID(id);

            inputDialog.Title = "Address";
            inputDialog.Text  = "Enter email address";
            inputDialog.Value = recipient.RecipientAddress;

            if (inputDialog.ShowDialog() == DialogResult.OK)
            {
                recipient.RecipientAddress = inputDialog.Value;
                recipient.Save();
            }

            Marshal.ReleaseComObject(recipients);
            Marshal.ReleaseComObject(recipient);

            ListRecipients();
        }
Пример #2
0
        private void ListRecipients()
        {
            using (new WaitCursor())
            {
                listRecipients.Items.Clear();

                var listViewItems = new List <ListViewItem>();

                hMailServer.DistributionListRecipients recipients = _representedObject.Recipients;

                for (int i = 0; i < recipients.Count; i++)
                {
                    hMailServer.DistributionListRecipient recipient = recipients[i];

                    var item = new ListViewItem(recipient.RecipientAddress)
                    {
                        Tag = recipient.ID
                    };

                    listViewItems.Add(item);

                    Marshal.ReleaseComObject(recipient);
                }

                Marshal.ReleaseComObject(recipients);

                listRecipients.Items.AddRange(listViewItems.ToArray());
            }
        }
Пример #3
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);
        }
Пример #4
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();
        }
Пример #5
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();
        }
        public void Add(string address)
        {
            int c = Count;

            for (int i = 0; i < c; i++)
            {
                if (_object[i].RecipientAddress == address)
                {
                    return;
                }
            }

            hMailServer.DistributionListRecipient r = _object.Add();
            r.RecipientAddress = address;
            r.Save();
        }
Пример #7
0
        private void ListRecipients()
        {
            listRecipients.Items.Clear();

            hMailServer.DistributionListRecipients recipients = representedObject.Recipients;

            for (int i = 0; i < recipients.Count; i++)
            {
                hMailServer.DistributionListRecipient recipient = recipients[i];

                ListViewItem item = listRecipients.Items.Add(recipient.RecipientAddress);
                item.Tag = recipient.ID;

                Marshal.ReleaseComObject(recipient);
            }

            Marshal.ReleaseComObject(recipients);
        }
Пример #8
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);
        }
Пример #9
0
        private void buttonAddRecipient_Click(object sender, EventArgs e)
        {
            formInputDialog inputDialog = new formInputDialog();

            inputDialog.Title = "Address";
            inputDialog.Text  = "Enter email address";

            if (inputDialog.ShowDialog() == DialogResult.OK)
            {
                hMailServer.DistributionListRecipients recipients = representedObject.Recipients;
                hMailServer.DistributionListRecipient  recipient  = recipients.Add();

                recipient.RecipientAddress = inputDialog.Value;
                recipient.Save();

                Marshal.ReleaseComObject(recipients);
                Marshal.ReleaseComObject(recipient);
            }

            ListRecipients();
        }
Пример #10
0
        private void buttonSelectRecipients_Click(object sender, EventArgs e)
        {
            formSelectUsers selectUsers = new formSelectUsers(true, 0);

            if (selectUsers.ShowDialog() == DialogResult.OK)
            {
                hMailServer.DistributionListRecipients recipients = representedObject.Recipients;

                List <string> listUsers = selectUsers.GetSelectedTexts();

                foreach (string address in listUsers)
                {
                    hMailServer.DistributionListRecipient recipient = recipients.Add();
                    recipient.RecipientAddress = address;
                    recipient.Save();

                    Marshal.ReleaseComObject(recipient);
                }

                Marshal.ReleaseComObject(recipients);

                ListRecipients();
            }
        }
 internal DistributionListRecipient(hMailServer.DistributionListRecipient o)
 {
     _object = o;
 }
 internal DistributionListRecipient(hMailServer.DistributionListRecipient o)
 {
     _object = o;
 }