i posted the same thing in the c# forum, didn't get a response and still having issues. I rewrote the same thing in vb.net, hopefully someone here might know the answer
i am writing this transport agent to verify the subject line of outgoing email on an exchange 07 server. it checks the subject line, if it is blank, it places a default subject, otherwise it format it to propercase and forwards the message (methdo to remove all capital letters from the subject line)..
Imports System
Imports System.Collections.Generic
Imports System.Text
Imports Microsoft.Exchange.Data.Transport
Imports Microsoft.Exchange.Data.Transport.Routing
Imports Microsoft.Exchange.Data.Transport.Smtp
Namespace mySubjectAgent
NotInheritable Class myRoutingFactory
Inherits RoutingAgentFactory
Public Overrides Function CreateAgent(ByVal server As SmtpServer) As RoutingAgent
Return New MyAgent
End Function
End Class
Public Class MyAgent
Inherits RoutingAgent
Private Sub MyEndOfDataHandler(ByVal source As SubmittedMessageEventSource, ByVal e As QueuedMessageEventArgs) Handles Me.OnSubmittedMessage
If e.MailItem.Message.Subject.Length = 0 Then
e.MailItem.Message.Subject = "Kranichs Jewelers"
Else
e.MailItem.Message.Subject = StrConv(e.MailItem.Message.Subject, VbStrConv.ProperCase)
End If
End Sub
End Class
End Namespace
the commands that i run in the exchange management shell are:
Install-TransportAgent -Name "mySubjectAgents" -TransportAgentFactory "mySubjectAgent.mySubjectAgent.myRoutingFactory" -AssemblyPath "E:\TransportAgents\mySubjectAgent.dll"
close management console
Enable-TransportAgent -Identity "SubjectAgent"
retstart the exchange transport
the angent installs, however it freezes the que and no email is sent out untilt he agent is disabled and uninstalled.
any help is appreciated, thanks