示例#1
0
 public new void SetUp()
 {
     _queue  = _application.GlobalObjects.DeliveryQueue;
     _status = _application.Status;
     // add an account to send from
     _account = SingletonProvider <Utilities> .Instance.AddAccount(_domain, "*****@*****.**", "test");
 }
示例#2
0
        private static int GetNumberOfMessagesInDeliveryQueue()
        {
            hMailServer.Application application = SingletonProvider <Utilities> .Instance.GetApp();

            hMailServer.DeliveryQueue queue  = application.GlobalObjects.DeliveryQueue;
            hMailServer.Status        status = application.Status;

            string messages = status.UndeliveredMessages;

            if (messages.Length < 4)
            {
                return(0);
            }

            string[] messageList = status.UndeliveredMessages.Split('\n');

            int count = 0;

            foreach (string message in messageList)
            {
                if (message.Length < 4)
                {
                    continue;
                }

                string recipients = message.Split('\t')[3];

                string[] recipientList = recipients.Split(',');

                count += recipientList.Length;
            }

            return(count);
        }
示例#3
0
 public new void SetUp()
 {
     _queue = _application.GlobalObjects.DeliveryQueue;
      _status = _application.Status;
      // add an account to send from
      _account = SingletonProvider<Utilities>.Instance.AddAccount(_domain, "*****@*****.**", "test");
 }
示例#4
0
        private hMailServer.DeliveryQueue GetDeliveryQueue()
        {
            hMailServer.GlobalObjects globalObjects = _application.GlobalObjects;

            hMailServer.DeliveryQueue deliveryQueue = globalObjects.DeliveryQueue;

            Marshal.ReleaseComObject(globalObjects);

            return(deliveryQueue);
        }
示例#5
0
        private void menuItemSendNow_Click(object sender, EventArgs e)
        {
            WaitCursor waitCursor = new WaitCursor();

            hMailServer.DeliveryQueue deliveryQueue = GetDeliveryQueue();
            foreach (ListViewItem item in listDeliveryQueue.SelectedItems)
            {
                string messageID = (string)item.Tag;

                deliveryQueue.ResetDeliveryTime(Convert.ToInt32(messageID));
            }

            deliveryQueue.StartDelivery();
            Marshal.ReleaseComObject(deliveryQueue);
        }
示例#6
0
        private void btnClearQueue_Click(object sender, EventArgs e)
        {
            string message = "Are you sure you want to clear the delivery queue?";

            if (MessageBox.Show(message, EnumStrings.hMailServerAdministrator, MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                WaitCursor waitCursor = new WaitCursor();

                hMailServer.DeliveryQueue deliveryQueue = GetDeliveryQueue();
                deliveryQueue.Clear();
                Marshal.ReleaseComObject(deliveryQueue);
            }

            RefreshDeliveryQueue();
        }
示例#7
0
        private void menuItemDelete_Click(object sender, EventArgs e)
        {
            string message = "Are you sure you want to delete selected message(s) from queue?";

            if (MessageBox.Show(Strings.Localize(message), EnumStrings.hMailServerAdministrator, MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                WaitCursor waitCursor = new WaitCursor();

                hMailServer.DeliveryQueue deliveryQueue = GetDeliveryQueue();
                foreach (ListViewItem item in listDeliveryQueue.SelectedItems)
                {
                    string messageID = (string)item.Tag;

                    deliveryQueue.Remove(Convert.ToInt64(messageID));
                }

                Marshal.ReleaseComObject(deliveryQueue);
            }

            RefreshDeliveryQueue();
        }
示例#8
0
        private static void DeleteMessagesInQueue()
        {
            hMailServer.Application application = SingletonProvider <Utilities> .Instance.GetApp();

            hMailServer.DeliveryQueue queue  = application.GlobalObjects.DeliveryQueue;
            hMailServer.Status        status = application.Status;

            string[] messages = status.UndeliveredMessages.Split('\n');
            foreach (string message in messages)
            {
                if (message.Length < 10)
                {
                    continue;
                }

                string[] info = message.Split('\t');
                int      id   = Convert.ToInt32(info[0]);

                queue.Remove(id);
            }

            application.SubmitEMail();
        }
示例#9
0
 public new void SetUp()
 {
     _queue = _application.GlobalObjects.DeliveryQueue;
      _status = _application.Status;
 }