OnDeliverMessage placement of call

Use this forum if you have problems with a hMailServer script, such as hMailServer WebAdmin or code in an event handler.
Post Reply
cblaze22
Normal user
Normal user
Posts: 203
Joined: 2011-08-30 20:16

OnDeliverMessage placement of call

Post by cblaze22 » 2019-05-06 04:48

When does OnDeliverMessage get called? Before a message goes into the queue, when its the one being processed in the queue, after its been delivered?

User avatar
mattg
Moderator
Moderator
Posts: 22437
Joined: 2007-06-14 05:12
Location: 'The Outback' Australia

Re: OnDeliverMessage placement of call

Post by mattg » 2019-05-06 05:16

Just 'cause I link to a page and say little else doesn't mean I am not being nice.
https://www.hmailserver.com/documentation

cblaze22
Normal user
Normal user
Posts: 203
Joined: 2011-08-30 20:16

Re: OnDeliverMessage placement of call

Post by cblaze22 » 2019-05-06 06:34

So where in that chain of commands does the message get put in the queue?

User avatar
mattg
Moderator
Moderator
Posts: 22437
Joined: 2007-06-14 05:12
Location: 'The Outback' Australia

Re: OnDeliverMessage placement of call

Post by mattg » 2019-05-06 10:22

I thought I answered in another thread.

OnAcceptMessage is when the message is added to the queue, but MessageID is not populated then
Just 'cause I link to a page and say little else doesn't mean I am not being nice.
https://www.hmailserver.com/documentation

cblaze22
Normal user
Normal user
Posts: 203
Joined: 2011-08-30 20:16

Re: OnDeliverMessage placement of call

Post by cblaze22 » 2019-05-06 14:41

Can you execute .Save on the message to get the ID?

cblaze22
Normal user
Normal user
Posts: 203
Joined: 2011-08-30 20:16

Re: OnDeliverMessage placement of call

Post by cblaze22 » 2019-05-07 07:18

When an email is added to the end of the queue, say index 40,000, so at the end.

Does OnDeliverMessage get called then WITH AN ID, or does OnDeliverMessage get called after all 39,000 get processed on that one email?

I am trying to find a location to immediately deliever an email based on a header and cant find a good location to do this to bypass the queue.

User avatar
mattg
Moderator
Moderator
Posts: 22437
Joined: 2007-06-14 05:12
Location: 'The Outback' Australia

Re: OnDeliverMessage placement of call

Post by mattg » 2019-05-07 10:53

cblaze22 wrote:
2019-05-07 07:18
I am trying to find a location to immediately deliever an email based on a header and cant find a good location to do this to bypass the queue.
We understand what you want, and the short answer is that you can't

Either use two hmailservers (same database and file store if you like - although not supported),and send regular mail through one and the ordinary emailed reports through the other.
Just 'cause I link to a page and say little else doesn't mean I am not being nice.
https://www.hmailserver.com/documentation

cblaze22
Normal user
Normal user
Posts: 203
Joined: 2011-08-30 20:16

Re: OnDeliverMessage placement of call

Post by cblaze22 » 2019-05-07 13:36

You say that but you were incorrect about the OnDeliveryFailed method. The code below sends an email right away. So you are telling me there is no place in the HMailServer scripting this can happen?

Code: Select all

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);
        }

User avatar
SorenR
Senior user
Senior user
Posts: 6315
Joined: 2006-08-21 15:38
Location: Denmark

Re: OnDeliverMessage placement of call

Post by SorenR » 2019-05-07 15:51

cblaze22 wrote:
2019-05-07 13:36
You say that but you were incorrect about the OnDeliveryFailed method. The code below sends an email right away. So you are telling me there is no place in the HMailServer scripting this can happen?

Code: Select all

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);
        }
It does not send it right away, it escalates the message to the top of the queue. There is a difference.

And yes, if you want this to happen you need to create a stand-alone script to monitor the queue and act accordingly. There is no place in Eventhandlers.vbs you can make it happen.

Well, unless you modify hMailServer core code, it's on Github ... :wink:
SørenR.

Woke is Marxism advancing through Maoist cultural revolution.

cblaze22
Normal user
Normal user
Posts: 203
Joined: 2011-08-30 20:16

Re: OnDeliverMessage placement of call

Post by cblaze22 » 2019-05-07 16:13

What do you mean by "And yes, if you want this to happen you need to create a stand-alone script to monitor the queue and act accordingly."?

Also there has to be a method hook for this. I cant believe we cant do anything to a message before it goes into the queue or right after. Should be an easy thing to do and would be super beneficial.

User avatar
SorenR
Senior user
Senior user
Posts: 6315
Joined: 2006-08-21 15:38
Location: Denmark

Re: OnDeliverMessage placement of call

Post by SorenR » 2019-05-07 16:51

cblaze22 wrote:
2019-05-07 16:13
What do you mean by "And yes, if you want this to happen you need to create a stand-alone script to monitor the queue and act accordingly."?

Also there has to be a method hook for this. I cant believe we cant do anything to a message before it goes into the queue or right after. Should be an easy thing to do and would be super beneficial.
If it so simple why don't you make a contribution to the code base?

I believe most of us have figured out that you want to be able to control queue prioritization. Question is if the core code supports this modification without someone having to rewrite the whole damn stuff.

Not that many of us here who work as programmers for a living.
SørenR.

Woke is Marxism advancing through Maoist cultural revolution.

cblaze22
Normal user
Normal user
Posts: 203
Joined: 2011-08-30 20:16

Re: OnDeliverMessage placement of call

Post by cblaze22 » 2019-05-07 18:10

Can you set the deliverytime of a message in the OnDeliverMessage method?

Post Reply