XCON: Message Handling for an Inbound SMTP Message Meant for the Local Store (233358)



The information in this article applies to:

  • Microsoft Exchange 2000 Server

This article was previously published under Q233358

SUMMARY

This article outlines the steps involved in the handling of an SMTP inbound message.

MORE INFORMATION

  1. An SMTP client opens a connection on the SMTP server.
  2. Inetinfo on the SMTP server is listening on port 25 and an SMTP service thread responds.
  3. After negotiation, the SMTP server gets the first command dealing with the message.
  4. Various protocol events are started at points throughout the SMTP transaction, and event sinks can be used to trap the events.
  5. The message command is received and accepted, and a store driver event is raised.
  6. A memory structure is created (referred to in the code as IMsg). The SMTP server starts storing envelope properties (sender, recipients) into IMSG.
  7. The SMTP Server then receives the DATA (or equivalent) command.
  8. To store the data, the SMTP service then calls GetContentHandle on the IMsg.
  9. IMsg then calls the store driver to obtain the content handle and envelope handle to store the data.Note 1: On a Windows 2000 server, the default store driver is the NTFS driver. Currently, even with Exchange 2000 Server installed, the default store driver is the NTFS store driver. In the future, when Exchange 2000 Server is installed, the server will be designated (during Setup) as a mailbox server. Consequently, the Exchange 2000 Server store driver will be installed at a higher priority than the default NTFS store driver. The IMsg is capable of figuring out which store driver to call. If it is the Exchange 2000 Server store driver, the content handle and envelope handle will be Installable File System (IFS) handles to Jet. With the current situation of the NTFS store driver, the content and envelope handles are for the Queue directory. Of course, if the server is designated as a bridgehead or gateway server, the Exchange 2000 Server store driver is not called, and messages are stored in NTFS, which is faster if the message is not going to the store anyway.

  10. The default store driver returns a file system pointer to the message body.
  11. The pointer is stored as the second piece of information in the IMsg.
  12. As explained in Note 1, the NTFS store driver writes the message body into the Queue directory.
  13. Upon successful receipt of the message, the SMTP server requests the IMsg to commit, which guarantees that all data for this message (including both the envelope and message data) is committed.
  14. The IMsg structure is handed to the Advanced Queuing engine, which places it in the Pre-Categorizer Queue.
  15. A Message Categorizer thread picks up the message from the Pre-Categorizer queue for processing.Note 2: This process involves several steps and consists of resolving the sender and then each recipient for the message until all recipients have been resolved. If the envelope recipient list includes distribution groups (the Windows 2000 equivalent of Distribution Lists), it expands the recipient list to include those members. Of course, this is true if expansion is allowed on this server. A per-sender and per-recipient limit check is applied, and recipients marked appropriately. Each recipient is marked as either "Gateway" (meaning that the recipient is reachable through the message transfer agent [MTA]) or "Local" (meaning that the recipient is actually on an Exchange 2000 store). The Categorizer raises several events that can be hooked into by event sinks.

  16. On completion of the Categorization process, the message is put into a per-destination-domain queue inside Advanced Queuing.
  17. Advanced Queuing now passes the destination to routing, which returns with a Next Hop identifier for that destination.
  18. If a message is destined for the local store, the Messaging Database (MDB) is stamped on the message, and it is placed in the local delivery queue.
  19. Advanced Queuing then calls the store driver to deliver the message by raising a store driver event.
  20. Advanced Queuing passes the IMsg and the indexes of the recipients to look at to the store driver.
  21. The Exchange 2000 Server store driver picks up the message and seeing that the recipient is marked as "Local," submits it to the store by means of the store-side store driver interface.

Modification Type:MinorLast Reviewed:4/28/2005
Keywords:kbinfo KB233358