Hi,
I have a problem and I'm hoping someone can help.
I'm trying to alter the subject field on emails by hooking onto the Exchange transport events. I need to do it this way as it seems to be the only way to do it Asynchronously.
I need to handle the subject field on incoming and outgoing emails which is why I can't use standard event sinks.
I think I could accomplish this if I had access to a resource which described the offsets needed to view the properties in the ReadContent function.
You can see my code below so you can see how I'm trying to so this. The googleatron seems to be lacking in this area as does MSDN (which is no surprise).
Thanks in advance
code:
Imports System.Runtime.InteropServices
Imports Microsoft.Exchange.Transport.EventInterop
Imports Microsoft.Exchange.Transport.EventWrappers
Namespace ManagedSinks
<Guid("560636A3-43E7-4978-A6C2-C8A2C71A10DD")> _
Public Class ExchangeNetSMTPIn
Implements ISmtpInCommandSink
Public Sub OnSmtpInCommand(ByVal pServer As Object, ByVal pSession As Object, ByVal pMsg As Microsoft.Exchange.Transport.EventInterop.MailMsg, ByVal pContext As Microsoft.Exchange.Transport.EventInterop.ISmtpInCommandContext) Implements Microsoft.Exchange.Transport.EventInterop.ISmtpInCommandSink.OnSmtpInCommand
'Code on SMTP Receive
End Sub
End Class
<Guid("7EDC41F9-2112-48a6-962A-1EBB32F53A25")> _
Public Class ExchangeNetSMTPOut
Implements ISmtpOutCommandSink
Public Sub OnSmtpOutCommand(ByVal pServer As Object, ByVal pSession As Object, ByVal pMsg As Microsoft.Exchange.Transport.EventInterop.MailMsg, ByVal pContext As Microsoft.Exchange.Transport.EventInterop.ISmtpOutCommandContext) Implements Microsoft.Exchange.Transport.EventInterop.ISmtpOutCommandSink.OnSmtpOutCommand
'Code on SMTP Send
End Sub
End Class
End Namespace
I have a problem and I'm hoping someone can help.
I'm trying to alter the subject field on emails by hooking onto the Exchange transport events. I need to do it this way as it seems to be the only way to do it Asynchronously.
I need to handle the subject field on incoming and outgoing emails which is why I can't use standard event sinks.
I think I could accomplish this if I had access to a resource which described the offsets needed to view the properties in the ReadContent function.
You can see my code below so you can see how I'm trying to so this. The googleatron seems to be lacking in this area as does MSDN (which is no surprise).
Thanks in advance
code:
Imports System.Runtime.InteropServices
Imports Microsoft.Exchange.Transport.EventInterop
Imports Microsoft.Exchange.Transport.EventWrappers
Namespace ManagedSinks
<Guid("560636A3-43E7-4978-A6C2-C8A2C71A10DD")> _
Public Class ExchangeNetSMTPIn
Implements ISmtpInCommandSink
Public Sub OnSmtpInCommand(ByVal pServer As Object, ByVal pSession As Object, ByVal pMsg As Microsoft.Exchange.Transport.EventInterop.MailMsg, ByVal pContext As Microsoft.Exchange.Transport.EventInterop.ISmtpInCommandContext) Implements Microsoft.Exchange.Transport.EventInterop.ISmtpInCommandSink.OnSmtpInCommand
'Code on SMTP Receive
End Sub
End Class
<Guid("7EDC41F9-2112-48a6-962A-1EBB32F53A25")> _
Public Class ExchangeNetSMTPOut
Implements ISmtpOutCommandSink
Public Sub OnSmtpOutCommand(ByVal pServer As Object, ByVal pSession As Object, ByVal pMsg As Microsoft.Exchange.Transport.EventInterop.MailMsg, ByVal pContext As Microsoft.Exchange.Transport.EventInterop.ISmtpOutCommandContext) Implements Microsoft.Exchange.Transport.EventInterop.ISmtpOutCommandSink.OnSmtpOutCommand
'Code on SMTP Send
End Sub
End Class
End Namespace