示例#1
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);
        }
示例#2
0
        public static void SendMessagesInQueue()
        {
            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');
                Int64    id   = Convert.ToInt64(info[0]);

                queue.ResetDeliveryTime(id);
            }

            application.SubmitEMail();
        }