Imports System Imports System.Collections.Generic Imports System.Text Imports Microsoft.Exchange.Data.Transport Imports Microsoft.Exchange.Data.Transport.Smtp Namespace XXXXX REM Change Needed Here NotInheritable Class YYYYYY REM Change Needed Here Inherits SmtpReceiveAgentFactory Public Overrides Function CreateAgent(ByVal server As SmtpServer) As SmtpReceiveAgent Return New ZZZZZ REM Change Needed Here End Function End Class Public Class ZZZZZ REM Change Needed Here Inherits SmtpReceiveAgent Private Sub MyEndOfDataHandler(ByVal source As ReceiveMessageEventSource, ByVal e As EndOfDataEventArgs) Handles Me REM Change Needed Here ' Get and change the recipient from alias_tag to alias (only doing for 1 recipient for simplicity) If e.MailItem.Recipients.Count = 1 And InStr(e.MailItem.Recipients.Item(0).Address, "_") > 1 Then Dim Recipient() As String = Split(e.MailItem.Recipients.Item(0).Address, "@", 2) Dim EmailAlias() As String = Split(Recipient(0), "_", 2) 'EmailAlias(0) = alias to send email to 'EmailAlias(1) = tag for subject line 'Recipient(1) = domain ' The following line prepends [tag] to the subject of the message. "[" + EmailAlias(1).ToString + "] " + e.MailItem.Message.Subject REM Change Needed Here 'the following drops the current recipient e.MailItem.Recipients.Remove(e.MailItem.Recipients.Item(0).Address) 'the following adds the recipient back again, this time using the alias without the tag e.MailItem.Recipients.Add(New RoutingAddress(EmailAlias(0).ToString + "@" + Recipient(1).ToString)) End If End Sub End Class End Namespace