1 / 46

MSG332 Developing Transport Event Messaging Solutions for Windows and Exchange

MSG332 Developing Transport Event Messaging Solutions for Windows and Exchange. Max Ciccotosto Program Manager - Exchange Microsoft Corporation. Agenda. Sinks Overview and Basics SMTP Service What can you do with events? Event model Programming Language Support Advanced

corby
Télécharger la présentation

MSG332 Developing Transport Event Messaging Solutions for Windows and Exchange

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. MSG332Developing Transport Event Messaging Solutions for Windows and Exchange Max Ciccotosto Program Manager - Exchange Microsoft Corporation

  2. Agenda • Sinks Overview and Basics • SMTP Service • What can you do with events? • Event model • Programming Language Support • Advanced • Content Conversion • Event registration • Interface descriptions • How to create transport and protocol event sinks

  3. Exchange 2003 Vs. 2000 • No changes in the Transport Infrastructure • Same events • Same interfaces • Exchange 2000 Sinks will work on 2003. • Added support for Retry • Improved documentation

  4. Add recipient to messages from Internet

  5. Windows SMTP Service • Store and forward relay • Mailing list (Distribution List or ‘DL’) expander • “Deliver” to Drop directory • “Pickup” from Pickup directory

  6. Protocol And Transport EventsThe Goals • To allow the creation of a mail system on top of the Windows 2000 SMTP Service • To allow the extension of Exchange 2000 and Windows 2000 SMTP Service

  7. Exchange • Exchange uses Windows SMTP Service • Exchange depends on SMTP Service • Exchange extends SMTP Service with events • Adds store (mailboxes), store driver (local delivery to store), a whole lot more • All messages go through events, even X.400 and RPC inbound/outbound

  8. Protocol And Transport Events • Access to all message properties • 821, 822 and Transport specific properties • Many places in the code to “hook in” • COM based, C++ only • Support for Synch and Asynch events • Fast!

  9. Event Model • Protocol Events • Extend SMTP protocol (ESMTP) • Modify existing SMTP protocol commands and responses • Transport Events • Extend message processing system (address resolution, restrictions processing, message routing) • Code runs on each message • Read/Write access to envelope and body • Executes in-process with IIS/SMTP

  10. Uses For Protocol Events • Billing and charge-back based on number of connections, time of connections • Monitoring system via SMTP, implement new ESMTP commands • Provide new SMTP authentication methods • Provide RCPT checking • Custom anti-spam scripts

  11. Uses For Transport Events • Forward all mail for a domain to a mailbox • Scan all inbound mail from the Internet for keyword, subject, attachment filename • Processing spans multiple internalmail systems • Virus checking • Spam (UCE) checking • Stop mail with all numeric From: address • Stop mail with keywords in subject or body • Add a disclaimer to all outbound mail to the Internet • Apply custom restrictions

  12. Event Overview • Protocol • Command Events • Transport • Submission • Pre Categorizer • Categorizer • Post Categorizer • Routing • Store Driver

  13. Routing Engine (IMessageRouter) OnSubmission Sink Store Submission Store Local Delivery PreCat Sink PostCat Sink MTS Out MTS Out MTS Out MTS Out MTS In MTS Out Message Categorizer MTA MTA Transport Core SMTP Service OnSubmission Event Routing Event SMTP Service Advanced Queuing PreCat Event Categorizer Events PostCat Event

  14. Language Support • C++ • CDO_onArrival • OnSubmission Event • Scriptable, dual-interfaced • CDO Message object gives easy access to message fields, attachments • Managed Wrappers • Wrappers for all Transport Objects • Interop abstraction • http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnsmtps/html/writingmngsinks.asp

  15. CDO Sink

  16. Content Conversion

  17. Exchange Content • No Content Conversion • SMTP Inbound from Internet • SMTP Outbound to Internet • Content Conversion • MAPI-Submitted • TNEF • Outlook 2000 • Outlook Web Access

  18. MAPI Client PreCat PostCat SMTP MailMsg MailMsg MailMsg Recipients: Content: S-TNEF Recipients: Content: MIME Recipients: Content: Default Internal User External User Internal User External User Body Body Bifurcation

  19. Exchange Issues Bottom Line • Not easy to modify content of MAPI/OWA-submitted messages • UNLESS it is going to “The Internet” • Design architecture so you don’t need to modify TNEF • Much easier to write Store Event sink to modify internal messages • Transport Events best suited for “the border”

  20. Disclaimer Sink

  21. Event Registration

  22. Server Event Bindings • Stored in Metabase • /smtpsvc/<instanceNumber>/EventManager • Event dispatcher (AQ) uses bindings to match sinks to events • Rules (“filter”) • Priority for each event • Event sinks executed in order of priority • Same priority events executed in random order

  23. Event Rules • Limit event call to certain messages • Case-insensitive • Can filter on MAIL FROM=, RCPT TO=, and EHLO= • Available on Submission, PreCat, PostCat events • Exchange tip • To catch MAPI-submitted messages, must have no filter rule

  24. Event Rule Example • MAIL FROM= user1@domain;RCPT TO=user2@domain • Makes sink only fire on messages from user1@domainOR to user2@domain • Can use wildcards: *@domain, user@foo* • Can have multiple RCPT TO:s, multiple MAIL FROM:s, multiple EHLOs; each is OR’d

  25. Creating Bindings • Use smtpreg.vbs available in the Exchange SDK. • Do it yourself: • SEO used to modify Metabase to create bindings • Tools for registration, de-registration, debugging (list binding) • VBScript, or can make sink self-registering via regsvr32 entry points • Troubleshooting: list bindings to see what is installed

  26. Registering Sinks:SMTPREG

  27. Protocol Events

  28. Protocol Event Sinks • Sink implements one or more sink interfaces • Each sink fired based on what category the session is in • Inbound • On Inbound Command, On Server Response • Outbound • Session Start, Message Start, Per-Recipient, Before Data, Session End

  29. Protocol Event Sinks • ISmtpInCommandSinkCalled when inbound SMTP command is received • ISmtpOutCommandSinkCalled when outbound SMTP command is to be sent • ISmtpServerResponseSinkCalled when server responds to previously sent command

  30. Protocol Event Interfaces • General Interface Property Bags • IServer - Information about the SMTP Virtual Server • ISession – Information about the current SMTP Session • IMailMsgProperties – Information about the current message being received • Context Interface • System-implemented interface • Sink can call to get and set information about commands and responses, set state

  31. Transport Events

  32. Transport Events • IMailTransportSubmission • OnSubmission event • Recipients should be added here (before categorizer-related events) • IMailTransportOnPreCategorize • Should be used to check recipient lists • All recipients should be present • IMailTransportOnPostCategorize • DLs will be expanded – actual recipients will be listed

  33. Transport EventsRelated Functions • IMailTransportNotify • Sink may return asynchronously, return MAIL_TRANSPORT_S_PENDING • That message will be halted and wait for callback via this function • Dispatcher will allow other messages to be processed until the thread pool limit

  34. Transport EventsRelated Functions • IsCacheable • If not defined, sink instance deleted after exit • Overhead of CoCreateInstance() for each event raised if not cache-able • Sink must be re-entrant/thread-safe • No shared data without proper locking • Protocol events also can implement

  35. IMailMsg • OnSubmission/PreCat/PostCat sinks get object IMailMsg • IMailMsgProperties object • MapContent() – maps content of message into memory • CopyContentToFile() – copies content of message to file • GetProperty()/PutProperty() – reads and writes properties • Many methods

  36. Subsequent Sinks • Sink returns S_OK • Other sinks at same or lower priority are called • Sink returns S_FALSE • Other sinks at same or lower priority are not called

  37. Recipe For Creating Transport Event Sink

  38. Creating Transport Sink • Implement sink interface method • Register event using smtpreg.vbs • Register COM interface of sink in registry • Register interface in event binding database in metabase via SEO • Send messages through, watch it fire!

  39. Managed Sink

  40. Ask The ExpertsGet Your Questions Answered • Talk one-on-one with a community of your peers • Community Experts: Microsoft product teams, consultants and Tech*Ed speakers • Resources: whiteboards, internet, etc. • Location: in the middle of the Exhibit Hall • Hours: at least 12-3:30p every day • I will be at the ATE after this session

  41. Community Resources • Community Resources http://www.microsoft.com/communities/default.mspx • Most Valuable Professional (MVP) http://www.mvp.support.microsoft.com/ • Newsgroups Converse online with Microsoft Newsgroups, including Worldwide http://www.microsoft.com/communities/newsgroups/default.mspx • User Groups Meet and learn with your peers http://www.microsoft.com/communities/usergroups/default.mspx

  42. Suggested Reading And Resources The tools you need to put technology to work! TITLE Available Microsoft® Exchange Server 2003 Administrator's Companion: 0-7356-1979-4 9/24/03 Microsoft® Windows® Server 2003 Administrator's Companion: 0-7356-1367-2 Today • Microsoft Press books are 20% off at the TechEd Bookstore • Also buy any TWO Microsoft Press booksand get a FREE T-Shirt

  43. Thank You!!! Please Fill Out The Evaluation Form massici@microsoft.com

  44. Community Resources • Community Resources http://www.microsoft.com/communities/default.mspx • Most Valuable Professional (MVP) http://www.mvp.support.microsoft.com/ • Newsgroups Converse online with Microsoft Newsgroups, including Worldwide http://www.microsoft.com/communities/newsgroups/default.mspx • User Groups Meet and learn with your peers http://www.microsoft.com/communities/usergroups/default.mspx

  45. evaluations

  46. © 2003 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. MICROSOFT MAKES NO WARRANTIES, EXPRESS OR IMPLIED, IN THIS SUMMARY.

More Related