Hello all. I am trying to find a way via an extension manager app, to trap a mail read event.
From searching the forum so far I haven’t seen any solution. I (like several others) have tried the EM_NSFNOTEOPEN hook, which appears to be non-specific to mail open events.
To be clear, I am loking to take the read event and be able to get message items via the MailGetMessageItemHandle calls.
Any ideas?
Subject: Extension Manager read mail event
Hi Matt,
what is exactly your problem:
- You are not able to read items on EM_NSFNOTEOPEN(EXTENDED) hook?
or
- You are not able to recognize if opened note is the mail or other type of doc?
Konrad
Subject: RE: Extension Manager read mail event
Correct. With the EM_NSFNOTEOPE and EXTENDED, the event is triggered many times and not specifically on a read mail event. So my first question is how do I filter out all NSFOPEN events except the read mail event?
Second, with the EM_NSFNOTEOPEN(EXTENDED) callback, the handle I am given is not a MessageHandle so I cannot call MailGetMessageItemHandle and such. So my second question is, once I’ve gotten the read mail event, how can I get the MailHandle for the specific mail item that is being read?
Thanks for your reply.
Subject: RE: Extension Manager read mail event
Matt,
Answer to second question:
I wrote it on this forum some time ago (see 25 May 2005)
"Open this note in your EM (according to known note id) to get the correct note handle.
NSFNoteOpen is allowed in your EM if you use EMCreateRecursionID."
Answer to first question:
Try to get base name with NsfNoteGetInfo and decide if this base is mailbox, for example if is located in mail\ directory. If this idea isn’t enough for you, let me know - we’ll combine other ideas 
Konrad Miśniakiewicz
Subject: RE: Extension Manager read mail event
Thanks, I think I can figure out how to handle the first question. Forgive me if I’ve overlooked something, but in regards to the second question…
I have found that I can do a NSFNoteOpen with the handle given in my EM_NSFNOTEOPEN callback, what I can’t figure out, is how I can invoke the mail specific “MailGetMessageItemHandle” functions since my handle is not a MailHandle. When I do try the mail specific functions with the given handle, I get the red error screen. Is there a way to get the MailHandle, or am I missing a step?
Subject: Extension Manager read mail event
The MailGetMessageItemHandle call is intended for outbound mail, and it sounds like you are dealing with existing mail being read. What are you actually trying to do, as there may be another alternative to accomplish your goal?
Subject: RE: Extension Manager read mail event
I figured it out.
I looked up the previous response that Konrad pointed out in his response. What I needed to do was call NSFNoteOpen to get the correct note handle, from there I can do an NSFItemInfo to get the details I’m interested in.
Thanks for your help.