![]() |
|
||||
Working with Inbound Messages for Sample GatewayThe following very simple procedure will demonstrate how message can be transferred backward through sample gateway. I assume that we have EDK gateway installed (this is sample gateway in its default pure form, without any modifications like changing its message type). Send an EDK message via sample gateway and observe it to appear in its Out folder. Open this message with notepad. Normally, in the beginning of this message you would see something like this: X-Tnef-Attach:
The second line above indicates the sender in Microsoft Exchange environment and the third line - the recipient. You need to edit the third line to make the recipient yourself. You can do it by copying data from the second line and putting it on the third, like here below: X-Tnef-Attach:
Of course, in your particular case the addressing information will be
different.
The procedure described above will only work for messages without rich text information. If you have created such a recipient using the "Other Address" template you should clear "Always send to this recipient in Microsoft Exchange rich-text format" check-box. If you forget to do this the message will be accompanied by a TNEF attachment with rich text info which apparently has addressing information as well. Then modifying RCPT TO property and not modifying accompanying TNEF attachment obviously puts these two parts out of synchronization and your gateway will be unable to process incoming messages. In fact, the gateway will attempt to process such message but will fail to convert it from RFC 822 standard to MAPI. I assume that it is configured to use ipm_in.dll conversion dll - the one which is installed by default. You would see an event in the application event log saying "ipm_in.dll conversion DLL convert function failed: point = SAMPLEGW.INBOUND, class = ENVELOPE.IPM, error code = 80004005". This error code is generic error: E_FAIL. Unfortunately, that's all that the event says - generic error of some kind. When errors like this happen it is possible and in fact very useful to run gateway under debugger and see where the call really fails. I have traced this error to the actual call into ipm_in.dll (m_pDllVector->pfnCnvConvert). I wanted to investigate it further and find out what was really going on. Fortunately, Microsoft provided source code for this conversion dll - it may be found in Mssdk/Samples/Exchange/ipm_in folder. I have managed to compile it and run under debugger by using my modified gateway as an executable for debug session with NOTSERV <GUID> parameters and specifying correct working directory. Having done that I have determined that inside ipm_in.dll the code failed to open TNEF attachment (IMessage::OpenAttach) when processing incoming message. I believe the reason of this being inconsistency in addressing (one address in RCPT TO property and the other in TNEF attachment). Fortunately everything works fine for messages without rich text info. One other useful thing to know is that a lot of Exchange related code
(and ipm_in.dll is one example) uses Exchange libraries such as exchsdk.lib.
In order to step in its functions you need to have source code. Conveniently
it is a part of Platform SDK installation. You will need to tell the debugger
where to find it.
|