public new void SetUp() { _queue = _application.GlobalObjects.DeliveryQueue; _status = _application.Status; // add an account to send from _account = SingletonProvider <Utilities> .Instance.AddAccount(_domain, "*****@*****.**", "test"); }
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); }
public new void SetUp() { _queue = _application.GlobalObjects.DeliveryQueue; _status = _application.Status; // add an account to send from _account = SingletonProvider<Utilities>.Instance.AddAccount(_domain, "*****@*****.**", "test"); }
private hMailServer.DeliveryQueue GetDeliveryQueue() { hMailServer.GlobalObjects globalObjects = _application.GlobalObjects; hMailServer.DeliveryQueue deliveryQueue = globalObjects.DeliveryQueue; Marshal.ReleaseComObject(globalObjects); return(deliveryQueue); }
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); }
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(); }
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(); }
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(); }
public new void SetUp() { _queue = _application.GlobalObjects.DeliveryQueue; _status = _application.Status; }