Use this forum if you have problems with a hMailServer script, such as hMailServer WebAdmin or code in an event handler.
- Normal user
- Posts: 36
- Joined: 2015-03-16 16:22
I hope you can help me.
I am trying to use oMessage.ID in my "OnAcceptMessage"-Event.
I want to change a database entry based on the message ID.
But the ID is always 0. Is the ID not set yet?
I only write into a text file to show my output
If you have a better idea how I can "debug" my script, pklease let me know
Code: Select all
Sub OnAcceptMessage(oClient, oMessage)
' write file
Set objFile = objFSO.CreateTextFile(outFile,True)
objFile.WriteLine("ID: " & CStr(oMessage.ID) & " END" & vbCrLf)
- Posts: 20881
- Joined: 2007-06-14 05:12
- Location: 'The Outback' Australia
https://www.hmailserver.com/documentati ... eptmessage
OnAcceptMessage is executed before hMailServer has accepted the email message and before it has been saved in the database. This means that you cannot access the ID of the message in this event.
Just 'cause I link to a page and say little else doesn't mean I am not being nice.
- Senior user
- Posts: 3617
- Joined: 2006-08-21 15:38
- Location: Denmark
OnDeliveryStart should be fine, the message is saved (.ID exists) and it's before Anti-Virus checks and before Global Rules are run.
I run my Custom Logger at "Sub OnDeliverMessage(oMessage)". No messages are moved between IMAPFolders yet even though a Global Rule says so... But that's another story
“Those who don't know history are doomed to repeat it.”
― Edmund Burke
- Normal user
- Posts: 185
- Joined: 2011-08-30 20:16
Can you call .Save in the OnAcceptMessage to get the ID?