|
Home > Archive > IIS and SMTP > July 2007 > Event Sinks
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
|
|
|
| I created an SMTP event sink for the outbound message OnServerResponse event.
I registered it with a rule for the EHLO, RCPT, MAIL, DATA and QUIT commands.
The event fires for all commands except DATA.
How can I get the event to fire for DATA? Or how can I get the
response/response code for the DATA command?
Any help is appreciated...
| |
| Sanford Whiteman 2007-06-28, 1:23 am |
| > How can I get the event to fire for DATA? Or how can I get the
> response/response code for the DATA command?
I believe you want your rule bound to _EOD (end of DATA). Remember that
the DATA part of a conversation actually has two subparts: 'DATA' (or
'BDAT') which for all practical purposes always has the same server
response of '354 Start mail input...', then the data stream itself,
followed by the final server response.
--Sandy
| |
|
| Ok, I didn't try the _EOD because it seemed that it was for inbound messages
only and I am working with outbound messages. I will try _EOD tomorrow.
What I need is the "final server response" that you mention below???
"Sanford Whiteman" wrote:
>
> I believe you want your rule bound to _EOD (end of DATA). Remember that
> the DATA part of a conversation actually has two subparts: 'DATA' (or
> 'BDAT') which for all practical purposes always has the same server
> response of '354 Start mail input...', then the data stream itself,
> followed by the final server response.
>
> --Sandy
>
| |
| Sanford Whiteman 2007-06-28, 7:26 am |
| > What I need is the "final server response" that you mention below???
You want the remote server's acceptance/rejection after your data is
submitted with the final <CR>.<CR>, right?
Since this occurs after OnBeforeData and before OnSessionEnd (note
OnSE refers to the entire session, during which more than one msg can
be sent), I can't see any rule that would match other than _EOD.
--Sandy
| |
|
| Thanks Sandy.
I can't get the _EOD rule to work with the OnServerResponse.
Is there any other way I can determine that the message was successfully
sent or if all of the commands during the session were successful?
"Sanford Whiteman" wrote:
>
> You want the remote server's acceptance/rejection after your data is
> submitted with the final <CR>.<CR>, right?
>
> Since this occurs after OnBeforeData and before OnSessionEnd (note
> OnSE refers to the entire session, during which more than one msg can
> be sent), I can't see any rule that would match other than _EOD.
>
> --Sandy
>
| |
| Ron Hinds 2007-06-29, 1:22 pm |
| "aw" <aw@discussions.microsoft.com> wrote in message
news:BC541D8B-BEB4-4A72-9677-0FF817EA5E5E@microsoft.com...
> Thanks Sandy.
>
> I can't get the _EOD rule to work with the OnServerResponse.
>
> Is there any other way I can determine that the message was successfully
> sent or if all of the commands during the session were successful?
What exactly are you trying to accomplish? Wouldn't it be easier to use the
OnArrival event, then use CDO to pick apart the message?
[vbcol=seagreen]
>
>
>
>
> "Sanford Whiteman" wrote:
>
| |
|
| How can I determine if an outbound message has been successfully accepted
(via the DATA command) using the SMTP event sinks? Which event sink will
expose an object that contains the status of the message delivery, for each
domain in the message?
"Ron Hinds" wrote:
> What exactly are you trying to accomplish? Wouldn't it be easier to use the
> OnArrival event, then use CDO to pick apart the message?
| |
| Ron Hinds 2007-06-29, 1:22 pm |
| Oh, I see, I misunderstood - I thought you were trying to do something with
the attachment, if any. You are trying to determine when a message has been
delivered. Sorry, I can't help you with that one...
"aw" <aw@discussions.microsoft.com> wrote in message
news:2CEA7E58-5BF7-437F-944E-AF53E9328416@microsoft.com...
> How can I determine if an outbound message has been successfully accepted
> (via the DATA command) using the SMTP event sinks? Which event sink will
> expose an object that contains the status of the message delivery, for
> each
> domain in the message?
>
>
> "Ron Hinds" wrote:
>
>
| |
| Sanford Whiteman 2007-07-02, 7:19 am |
| > I can't get the _EOD rule to work with the OnServerResponse.
Neither could I. It is the only appropriate rule, however. In more
testing, I was unable to capture the event you're describing and get
appropriate context/status. All of my protocol sinks are inbound, so I
never ran into this problem before; sorry to mislead you by implying
there is an easy fix.
I have been doing quite a bit more research to see if there are any
in-the-wild ways of doing what you want with SEO. So far, I have to
conclude that there's almost certainly a bug, or deliberate gap, in
the IIS SEO architecture. MSDN's diagrams for SEO event flow seem to
treat QUIT as if it were equivalent to outbound _EOD, but that isn't
the way SMTP works (and IIS itself obviously knows this).
On a side note, we do know that the delivery disposition of individual
messages within a session is available when Exchange has Message
Tracking turned on. Exchange sinks the event OnMsgTrackLog to do this.
It looks like tje event is raised in vanilla IIS SMTP (without
Exchange), but OnMsgTrackLog is not documented and vanilla SMTPSVC
does not sink it. In sum, we have to disregard this higher level of
logging for our purposes.
Vanilla SMTPSVC does raise OnEventLog, but it too is neither
documented nor sunk by default (or the binding is hidden). Even
without the binding, SMTPSVC does log events as Event ID 400x on
message delivery failure, but the log messages are notably brief. They
only cover what appear to be socket failures to an MX record, and do
not refer back to the larger message context (Message-ID, envelope
sender, envelope recipient). This _suggests_ -- though it certainly is
not a sure thing -- that SMTPSVC doesn't have more access to the
message context than outside developers do. Still, it is irksome that
_something_ may be logged at the precise point you want to be passed
control, at least on failure. You might play with sinking the
undocumented OnEventLog just to check it out for anything publicly
accessible.
On the other hand, SMTPSVC's built-in binding is to StoreDriver. At
http://technet.microsoft.com/en-us/.../aa998408.aspx, it is
suggested that a StoreDriver event -- not clear which one -- is fired
when there is file I/O in the backing NTFS store. Presumably, this
would be fired on delivery success, transient delivery failure, or
permanent delivery failure, since even a move into retry state would
fit this description: "The content file is closed only when messages
are ready to be deleted or are scheduled to be retried at a later
time." Of course, the StoreDriver subevents are not, AFAICS,
documented. And who knows what context info you would be passed, if
any? But it might bear investigating before dismissal.
That pretty much exhausts the SEO-related tactics I could think of
OTOH.
The next angle of approach would be the logging stage, since we know
that eventually the remote server's signoff, including the Message-ID,
is logged to disk or ODBC. Unfortunately, I've never been able to make
IIS' Custom Logging API work with the SMTP service; your results might
be more positive. The reason I mention the API specifically is that
that's the only way you're going to be able to service a synchronous
stream of events. Standard logging (as you probably know) can be
highly asynchronous. This is by design, I know, but it means that it
would be impossible for you to neatly `tail` a logfile or query a SQL
db when an event is raised; you'd need to asynchronously check the log
for at least couple of minutes before returning a result. That could
get messy.
Another approach would be to openly acknowledge the asynchronous
nature of the logs and have a separate log watcher process that
records all Message IDs and their delivery dispositions. I do
something *like* this for a client who needs to monitor communications
with specific remote servers (off-site archiving servers) -- I log to
ODBC and tag rows as "interesting" if they contain an IP and the
requisite 250- signoff, then monitor the count every 5 minutes.
However, a big caveat is that the client just wants a rough estimate
of uptime/downtime/throughput/trends. They know they're not
necessarily logging everything, because ODBC logging can drop rows
under high load. But they'll know quickly if there's surge or a dip.
That roughness will likely not suffice for you, but a more granular
look into logfiles on disk might: I'm not sure exactly what you're
building.
Yet another approach would be to alter message properties before
delivery so that DSN is requested for (notify=3Dsuccess,failure), then=
intercept the resulting DSN and parse out the message-ID from the
contents. While complex, this one may cover the widest range of
situations once it's set up, and it would allow you to passively
respond to a stream of incoming data instead of polling.
Although I too am skeptical of the idea that the outbound _EOD status
simply can't be reliably captured by a 3rd-party software... IIS'
native SMTP logs are so notoriously difficult to parse in detail (due
to the lack of session or message ID reconciliation) that it is
certainly not beyond belief. I'd be happy to work more on this with
you off-list if you want.
--Sandy
|
|
|
|
|